Information protection
The Core SDK Admin library provides Microsoft 365 Admin APIs for working with information protection.
Creating Context
In this article, you'll see a lot of context use: in this case this is a PnPContext which was obtained via the PnPContextFactory as explained in the overview article and show below:
using (var context = await pnpContextFactory.CreateAsync("SiteToWorkWith"))
{
// See next chapter on how to use the PnPContext for doing Microsoft 365 admin operations
}
PnP.Core.Admin dependency
The functionality shown in this article depends on the PnP.Core.Admin nuget package. Once the PnP.Core.Admin nuget package has been installed you can get to the Microsoft 365 admin features via using the GetMicrosoft365Admin extension method:
using (var context = await pnpContextFactory.CreateAsync("SiteToWorkWith"))
{
// Use the GetMicrosoft365Admin extension method on any PnPContext
// to tap into the Microsoft 365 admin features
var isMultiGeo = await context.GetMicrosoft365Admin().IsMultiGeoTenantAsync();
}
Enumerate the available sensitivity labels
Sensitivity labels from the Microsoft Information Protection solution let you classify and protect your organization's data, while making sure that user productivity and their ability to collaborate isn't hindered. When you want to set a sensitivity label you first need to enumerate the labels to understand which labels there are via one of the GetSensitivityLabels methods:
var labels = await context.GetMicrosoft365Admin().GetSensitivityLabelsAsync();