Accessing In-Reply-To and References Headers via Microsoft.Office.Interop.Outlook

Edmond Chong 0 Reputation points
2024-08-28T07:53:27.43+00:00

Dear Microsoft Support Team,

I hope this message finds you well.

I am working on a project that involves accessing specific email headers, specifically In-Reply-To and References, from .msg files using the Microsoft.Office.Interop.Outlook library. However, I am having difficulty identifying the correct MAPI property tags to retrieve these headers. For example, I have used http://schemas.microsoft.com/mapi/proptag/0x1035001E to retrieve the Message-ID, but I am unsure of the equivalent tags for the headers I need.

Could you please provide guidance on the appropriate MAPI property tags for these headers, or suggest an alternative approach to programmatically access them within Outlook using Interop?

Your assistance would be invaluable in ensuring compatibility and accuracy in handling email conversations within our application.

Thank you very much for your support.

Microsoft 365 and Office Development Other
Outlook Windows Classic Outlook for Windows For business
Exchange Exchange Server Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2024-08-28T07:53:27.4466667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The MAPI properties for the In-Reply-To and References headers are not explicitly defined in the provided context. However, the Mapping of Internet Mail Attributes to MAPI Properties document describes how a MAPI transport provider or MAPI-aware gateway which connects to the Internet should translate between MAPI message properties and Simple Mail Transport Protocol (SMTP) message attributes. This document may provide some guidance on how to map the SMTP headers for In-Reply-To and References to their corresponding MAPI properties.

    Alternatively, you can try using the PropertyAccessor object of the Outlook object model to access these headers programmatically within Outlook using Interop. The following code sample in Visual C# shows how to use the PropertyAccessor object to retrieve the In-Reply-To header:

    string schemaPR_IN_REPLY_TO_ID = "http://schemas.microsoft.com/mapi/proptag/0x1042001F";
    string PR_IN_REPLY_TO_ID = item.PropertyAccessor.GetProperty(schemaPR_IN_REPLY_TO_ID);
    

    For the References header, you can try using the following MAPI property:

    string schemaPR_CONVERSATION_INDEX = "http://schemas.microsoft.com/mapi/proptag/0x00710102";
    string PR_CONVERSATION_INDEX = item.PropertyAccessor.GetProperty(schemaPR_CONVERSATION_INDEX);
    

    Note that these code samples are provided as guidance only and may need to be adapted to fit your specific use case.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.