Welcome to MSDN Blogs Sign in | Join | Help

Outlook 2007 Beta Documentation - Blocked Attachments

[This is now documented here: http://msdn.microsoft.com/en-us/library/bb820936.aspx]

This is preliminary documentation for Outlook 2007 Beta 2. It does not apply to earlier versions of Outlook.

Blocked Attachments
Microsoft Outlook includes a feature that blocks attachments that are considered unsafe. The attachments which are blocked can vary from client to client depending on how Outlook is configured and on policies the administrator may have applied. See http://support.microsoft.com/kb/829982 for more information on how this is configured.

Custom code can query to see if a particular attachment is considered blocked by Outlook using the IAttachmentSecurity interface. This interface exposes a function, IsAttachmentBlocked, which will analyze a file name and report if this attachment is considered blocked by Outlook and won’t be shown in the UI or indexed.

Definition
DEFINE_GUID(IID_IAttachmentSecurity,
			0xB2533636,
			0xC3F3, 0x416f, 0xBF, 0x04, 0xAE, 0xFE, 0x41, 0xAB, 0xAA, 0xE2);
#define MAPI_IATTACHMENTSECURITY_METHODS(IPURE) \
MAPIMETHOD(IsAttachmentBlocked) \
		(LPCWSTR pwszFileName, BOOL *pfBlocked) IPURE; 

DECLARE_MAPI_INTERFACE_(IAttachmentSecurity, IUnknown)
{
    BEGIN_INTERFACE
    MAPI_IUNKNOWN_METHODS(PURE)
    MAPI_IATTACHMENTSECURITY_METHODS(PURE)
};

Usage
This interface can be obtained by calling QueryInterface on the MAPI session object, requesting IID_IAttachmentSecurity. IsAttachmentBlocked will return true in pfBlocked if the attachment is considered blocked by Outlook and won’t be shown in the UI or indexed

HRESULT IsAttachmentBlocked(LPMAPISESSION lpMAPISession, LPCWSTR pwszFileName, BOOL* pfBlocked)
{
	if (!lpMAPISession || !pwszFileName || !pfBlocked) return MAPI_E_INVALID_PARAMETER;

	HRESULT hRes = S_OK;
	IAttachmentSecurity* lpAttachSec = NULL;
	BOOL bBlocked = false;

	hRes = lpMAPISession->QueryInterface(IID_IAttachmentSecurity,(void**)&lpAttachSec);
	if (SUCCEEDED(hRes) && lpAttachSec)
	{
		hRes = lpAttachSec->IsAttachmentBlocked(pwszFileName,&bBlocked);
	}
	if (lpAttachSec) lpAttachSec->Release();

	*pfBlocked = bBlocked;
	return hRes;
}// IsAttachmentBlocked
Published Tuesday, May 09, 2006 9:09 AM by Stephen Griffin

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Outlook 2007 RTM Docs - Blocked Attachments

(Now that Outlook 2007 is available I'm reposting some of the articles from the Outlook 2007 Beta Documentation

Thursday, March 01, 2007 10:02 AM by SGriffin's [MSFT] WebLog

# Outlook 2007 RTM Docs - List of provider GUIDs set in the registry

(Now that Outlook 2007 is available I'm reposting some of the articles from the Outlook 2007 Beta Documentation

Wednesday, March 07, 2007 1:19 PM by SGriffin's [MSFT] WebLog

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker