Share via

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

Kfir Alfandary 20 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 Security | Microsoft Purview

Answer accepted by question author

Chandra Boorla 15,475 Reputation points Microsoft External Staff Moderator
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.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most 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.