Search code examples
c#outlookinteropazure-information-protection

How to set Azure Information Protect property in C#


I have an app that sends an email using interop in C#, I need to set the Azure Information Protection property when sending the email, I've had a look online but can't seem to find any solid answers.

Any help would be really appreciated even if it's pointing me in the right direction.


Solution

  • When a label is applied to a document or email, under the covers, the label is stored in metadata so that applications and services can read the label:

    • In emails, this information is stored in the x-header: msip_labels: MSIP_Label_<GUID>_Enabled=True;

    • For Word documents (.doc and .docx), Excel spreadsheets (.xls and .xlsx), PowerPoint presentations (.ppt and .pptx), and PDF documents, this metadata is stored in the following custom property: MSIP_Label_<GUID>_Enabled=True

    For emails, the label information is stored when the email is sent. For documents, the label information is stored when the file is saved.

    To identify the GUID for a label, locate the Label ID value on the Label blade in the Azure portal, when you view or configure the Azure Information Protection policy. For files that have labels applied, you can also run the Get-AIPFileStatus PowerShell cmdlet to identify the GUID (MainLabelId or SubLabelId). When a label has sublabels, always specify the GUID of just a sublabel and not the parent label.

    Read more about that in the Configuring the Azure Information Protection policy article.