Freigeben über


Überprüfen, ob eine Anlage blockiert ist

Gilt für: Outlook 2013 | Outlook 2016

In diesem Codebeispiel in C++ wird gezeigt, wie Sie die Schnittstelle IAttachmentSecurity : IUnknown verwenden, um herauszufinden, ob eine Anlage durch Microsoft Outlook 2010 oder Microsoft Outlook 2013 zum Anzeigen und Indizieren blockiert wird.

IAttachmentSecurity: IUnknown wird von der IUnknown-Schnittstelle abgeleitet. Sie können die IAttachmentSecurity: IUnknown-Schnittstelle abrufen, indem Sie IUnknown::QueryInterface für das MAPI-Sitzungsobjekt aufrufen und IID_IAttachmentSecurity anfordern. IAttachmentSecurity::IsAttachmentBlocked gibt true in pfBlocked zurück, wenn die Anlage von Outlook 2010 oder Outlook 2013 als unsicher eingestuft und für die Anzeige und Indizierung in Outlook 2010 oder Outlook 2013 blockiert wird.

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; 
}