Can I use Microsoft Information Protection (MIP) SDK C++ to read sensitivity label of a file, without cloud communication?

Kfir Alfandary 0 Reputation points
2025-04-14T13:21:59.0266667+00:00

Hey,I am developing a Desktop application in C++, and I want to use the File SDK to read a file's sensitivity label.

std::string getSensitityLabel(const std::string& filename);

getSensitityLabel should return the label-id of the sensitivity label. e.g f42a3342-8706-4288-bd31-ebb85995028z

I'm following the Quickstart: Set and get a sensitivity label (C++), which requires authenticating to create the MIP engine. However, as a requirement, I can't communicate with the cloud, and therefore can't perform the authentication.

Since the sensitive label is part of the file itself, I find it reasonable to be able to read it using the SDK without cloud communication.

Is there a guide on how to do this?

Thanks!

Microsoft Purview
Microsoft Purview
A Microsoft data governance service that helps manage and govern on-premises, multicloud, and software-as-a-service data. Previously known as Azure Purview.
1,532 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Chandra Boorla 11,750 Reputation points Microsoft External Staff
    2025-04-14T19:18:51.0466667+00:00

    @Kfir Alfandary

    You are absolutely right that sensitivity label metadata is embedded within the file itself, and it makes sense to expect that reading it might be possible without contacting the cloud. However, based on the current capabilities of the Microsoft Information Protection (MIP) SDK, it is unfortunately not possible to use the SDK in C++ to read sensitivity labels from a file without first authenticating to the Microsoft 365 cloud.

    Why the SDK Still Needs Cloud Authentication

    Even though the label is stored locally in the file, the Microsoft Information Protection (MIP) SDK is architected to always work within the context of a user and a policy, both of which require initial authentication to Azure Active Directory (AAD).

    The SDK performs actions like:

    • Downloading the label policy tied to a user/tenant.
    • Resolving label names, descriptions, and hierarchy.
    • Enforcing policy rules based on label settings.

    So, without that initial authenticated context, the SDK cannot be initialized - and as a result, even basic operations like reading the label ID aren’t supported.

    I hope this information helps. Please do let us know if you have any further queries.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    Thank you.

    1 person found this answer helpful.

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.