Outlook 2007 RTM Docs - Blocked Attachments
[This is now documented here: https://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 https://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
Comments
Anonymous
August 30, 2007
...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!!!! 2cAnonymous
August 30, 2007
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?Anonymous
January 29, 2008
Why not detect if an AV scanner is installed? If the file is scanned & clean, allow it to be opened.Anonymous
January 29, 2008
?? 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.