Apply Sensitivity Labels to Microsoft Exchange Mail via .NET core code.

Amit Singh Rawat 731 Reputation points
2024-09-17T14:33:48.4766667+00:00

Hi,

I would like to apply sensitivity labels to emails programmatically. I have successfully obtained the email ID (message ID) and sensitivity label ID using Graph API in .NET Core Application C#.

However, I cannot find an endpoint within the Microsoft Graph API or any other way via code that allows me to apply the sensitivity label directly to the email.

I have necessary APP Permission and App details like tenant id, client id etc.

I don't want to download email file and apply sensitivity label like any other file. Just like graph API support updating content and subject of exchange email. Can we apply labels as well.

Thank you in advance for your help.

Microsoft Exchange Online
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,882 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yakun Huang-MSFT 4,240 Reputation points Microsoft Vendor
    2024-09-19T02:09:46.17+00:00

    Hi @Amit Singh Rawat

    You can apply sensitivity labels to messages by creating single-value properties. Sensitivity labels can be assigned by extending the PidTagSensitivity attribute, but the label values can only be values for three sensitivity levels. See this article for details.

    To set extended properties, see Endpoints.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


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.