How to use the IAttachmentSecurity API to verify whether an attachment is considered to be blocked in Outlook (919199)
The information in this article applies to:
- Microsoft Office Outlook 2007
Beta InformationThis article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.
No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location where you downloaded the release.INTRODUCTION
Microsoft Office Outlook 2007 includes a feature that blocks attachments that are considered unsafe. Custom code can query to verify whether Outlook considers a particular attachment to be blocked. The code does this by using the IAttachmentSecurity API. MORE INFORMATIONBlocked attachmentsThe attachments that are blocked by Outlook 2007 can vary from client to client. Which attachments are blocked depends on how Outlook 2007 is configured and on policies that the administrator has applied.
For more information about how Outlook blocks attachments, click the following article number to view the article in the Microsoft Knowledge Base:
829982
Cannot open attachments in Microsoft Outlook
The IAttachmentSecurity API exposes the IsAttachmentBlocked function. This function analyzes a file name. Then, the IsAttachmentBlocked function reports whether the file is considered to be blocked by Outlook. If the file is blocked, it is not shown in or indexed in Outlook 2007. Definition of the IAttachmentSecurity APIDEFINE_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 of the IAttachmentSecurity APIThis interface can be obtained by calling the QueryInterface function on the MAPI session object, requesting IID_IAttachmentSecurity. IsAttachmentBlocked will return "true" in "pfBlocked" if the attachment is considered blocked by Outlook, and therefore is not shown in or indexed in Outlook 2007. 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
Modification Type: | Major | Last Reviewed: | 6/26/2006 |
---|
Keywords: | kbExpertiseInter kbinfo KB919199 kbAudDeveloper |
---|
|