Outlook 2007 RTM Docs – Blocked Attachments

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

(Now that Outlook 2007 is available I’m reposting some of the articles from the Outlook 2007 Beta Documentation series. Some of the articles are virtually unchanged, others are completely different to reflect the differences between Beta and RTM. This article is the updated version of Outlook 2007 Beta Documentation – 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.


			0xC3F3, 0x416f, 0xBF, 0x04, 0xAE, 0xFE, 0x41, 0xAB, 0xAA, 0xE2);
MAPIMETHOD(IsAttachmentBlocked) \
		(LPCWSTR pwszFileName, BOOL *pfBlocked) IPURE; 

DECLARE_MAPI_INTERFACE_(IAttachmentSecurity, IUnknown)


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;

	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
Comments (4)

  1. outlookhates attachments says:

    …and wouldn’t you find it strange that I have ended at this site, looking at a way to open an attachment that Outlook has decided is unsafe for me.

    Why, oh why do I not have the power to control this garbage myself? I dislike it when MSFT by default treats all users as idiots? And when we are not idiots, we are treated as idiots when trying to turn off features that we advanced users can’t stand!!!!


  2. If you’re looking for a way to extract the blocked attachments, you can use mfcmapi (http://codeplex.com/mfcmapi).

    As for why blocked attachments can’t be easily unblocked, suppose it were easy. Suppose it was just a reg key you have to set to unblock the attachments. Wouldn’t that reg key be the first thing to get set in an attack?

  3. James Ladan says:

    Why not detect if an AV scanner is installed?  If the file is scanned & clean, allow it to be opened.

  4. ?? This documentation isn’t about how Outlook determines whether or not an attachment is safe. It’s just about asking Outlook whether or not a file is going to be blocked.

Skip to main content