Access sensitivity label (MIP) on .msg file via C#

Sascha Günther 1 Reputation point
2021-07-06T13:30:05.917+00:00

Hi!

I'm currently developing an Add-In for Outlook with C#. The Add-In sends the content of a composed E-Mail to an external web service. This should be prevented whenever there are certain labels assigned (e.g. highly confidential). I'm using NetOffice (https://netoffice.io/) for the Add-In development.

In Word, Excel and PowerPoint I can read the MIP-Label by accessing CustomDocumentProperties (NetOffice.WordAPI.Document.CustomDocumentProperties). For Outlook (MailItem) ther are no such properties available, neither in any other property I can find the information.

Using the MIP-SDK is not an option because of the overhead of configuration (App Registration).

Does anyone know how to access the MIP-Label on a MailItem?

Thanks in advance!

Developer technologies | C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2021-07-06T13:55:38.207+00:00

    The third party library NetOffice has a dedicated support site on Github where you should probably ask your question. Since this library isn't produced by MS and you cannot use the MS-sanctioned MIP library it doesn't seem like we will be much help here.

    Just taking a guess, given that they are clear that they literally just wrap the Outlook COM interfaces, then there seems several places you could look.

    • OISensitivity has a value for Confidential which may or may not line up with the MIP setting, you'll have to test it. That is exposed on the Sensitivity property of MailItem.
    • ItemProperties contains the mail item's properties. Since there is no "document" for Outlook this seems like the closest equivalent. It is documented as containing both standard and user-defined properties.

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.