Search code examples
c++comatlmapi

How to retrieve content type from a MAPI Imessage



i am new to MAPI programming. i am trying to check if a MAPI Imessage (c++ IUnknown object) is encrypted or not, if i have a mime in hand i will check for the content type, but what to check for in MAPI IMessage object?
i have seen PR_X400_CONTENT_TYPE property, i am not sure if this is the desired property, because i am not able to get it using IMessage::GetProps function. i tried using the following code:

SizedSPropTagArray(9, mcols) = { 9, { PR_MESSAGE_CLASS, PR_SENDER_NAME, PR_SENDER_EMAIL_ADDRESS, PR_RTF_IN_SYNC, PR_RECEIVED_BY_EMAIL_ADDRESS, PR_RECEIVED_BY_NAME, PR_RECEIVED_BY_ENTRYID, PR_TRANSPORT_MESSAGE_HEADERS, PR_X400_CONTENT_TYPE } };
ULONG pcount; SPropValue *props = 0; HRESULT hr;
hr = message->GetProps((SPropTagArray*)&mcols, 0, &pcount, &props);
if (props[8].ulPropTag == PR_X400_CONTENT_TYPE) {
// not going here
}


but its not returning this specific property.
thanks in advance.


Solution

  • MAPI does not store the content type since MIME is not a native storage for MAPI. Use the PR_MESSAGE_CLASS property - it will be IPM.NOTE.SMIME.MultipartSigned.* for the signed messages and IPM.NOTE.SMIME.* for the encrypted messages.