Share via

How to get sensitivity label on a draft email and set another one outlook addin

Andreas Davros 101 Reputation points
2024-10-23T07:51:17.3633333+00:00

Hello,

Summarising the discussion of this thread: We are trying to retrieve the sensitivity label applied on a draft email - after that we would like to apply some checks and enforce a different one.

We get the email information through

https://graph.microsoft.com/v1.0/me/messages/{messge_id}  but this fetches no information regarding the sensitivity label applied.

  1. Is it possible to get this information through a different endpoint..?
  2. Is there a way to apply a different label..?

Thank you,

Andreas

Outlook | Windows | Classic Outlook for Windows | For business
Microsoft Security | Microsoft Purview

1 answer

Sort by: Most helpful
  1. Smaran Thoomu 35,125 Reputation points Microsoft External Staff Moderator
    2024-10-24T14:12:27.2066667+00:00

    Hi @Andreas Davros

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Currently, the Microsoft Graph API does not directly return the sensitivity label information for a draft email through the me/messages/{message_id} endpoint. However, the sensitivity label data is typically stored as part of the email’s metadata and may be available through different properties, depending on your setup and permissions.

    One approach is to use Microsoft Information Protection SDK or Exchange Online PowerShell to get the sensitivity label applied to a message. While this isn’t available directly via Graph API for draft emails, the label might be exposed through other API endpoints or via a compliance-related service.

    Applying a Different Sensitivity Label:

    To apply or change a sensitivity label programmatically, you could use:

    1. Microsoft Graph API for updating the message, but you’ll need to set the sensitivity header or modify its properties.
    2. Outlook Add-ins with MIP SDK: You can integrate sensitivity label functionality directly into your custom add-in, which allows you to enforce or modify labels based on your specific logic.

    Unfortunately, there's currently no direct API to update a sensitivity label via Graph API but using the MIP SDK would allow you to perform labeling changes on emails.

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    Was this answer helpful?


Your answer

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