Determine if Outlook downloaded only the header of a message
Applies to: Outlook 2013 | Outlook 2016
This topic shows a code sample in Visual C++ that uses the named PidLidHeaderItem Canonical Property to determine whether Microsoft Outlook 2013 has downloaded only the header of a message or the header and the body of a message.
BOOL bIsHeader(LPMESSAGE lpMessage)
{
HRESULT hRes = S_OK;
BOOL bRet = false;
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
LPSPropTagArray lpNamedPropTag = NULL;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
NamedID.lpguid = (LPGUID) &PSETID_Common;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = dispidHeaderItem;
lpNamedID = &NamedID;
hRes = lpMessage->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
if (lpNamedPropTag && 1 == lpNamedPropTag->cValues)
{
lpNamedPropTag->aulPropTag[0] = CHANGE_PROP_TYPE(lpNamedPropTag->aulPropTag[0], PT_LONG);
//Get the value of the property.
hRes = lpMessage->GetProps(lpNamedPropTag, 0, &ulVal, &lpPropVal);
if (lpPropVal && 1 == ulVal && PT_LONG == PROP_TYPE(lpPropVal->ulPropTag) && lpPropVal->Value.ul)
{
bRet = true;
}
}
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
return bRet;
}