-
Notifications
You must be signed in to change notification settings - Fork 273
Working with Sensibility Labels
As part of Office 365 you can apply sensibility labels to you documents. A sensibility label is a meta data tag that can be set on document. These tags can also enforce the documents to be encrypted and also apply watermarks and texts in the headers and footers. To apply sensitivity labels you use the Microsoft Information Protection SDK.
Our sample project, EPPlus.Samples.SensibilityLabels, shows how you use EPPlus with the Microsoft Information Protection SDK to handle sensibility labels on your Excel files.
To use this sample, you will need to the following:
- A Microsoft Purview account
- A Microsoft 365 Business Premium subscription or similar supporting sensibility labels.
- An application registration in Azure to get access your sensitivity labelling data.
If you don't have a Microsoft Purview account, you can create one at https://purview.microsoft.com/ using your Azure account.
This tutorial will not cover the setup of your Microsoft Purview account, but you can find guide lines here: Microsoft Purview setup guides
Add at least one sensitivity label to use in the sample under Information Protection - Sensibility labels menu.
To use the Microsoft Information Protection API, you need to register an application in the Azure portal or the Microsoft Entra admin center.
To setup your application registration and your workstation, please see this guide Microsoft Information Protection (MIP) SDK setup and configuration.
When the setup is done, in the application registration, add a redirection Uri to: http://localhost, if you run the sample from Visual Studio.
Before you can run the sample you will need to specify a few parameters in the SetupConstants.cs file.
-
_tenantId - The Directory (tenant) ID from the App Registration's Overview page.
-
_clientId - The Application (client) ID from the App Registration's Overview page.
-
_appName - The application display name from the app registration.
-
_loginAccount - The account used to login and get the access token. This account must have access to the protected content we are working with in the samples.
-
_labelSample1 - The name of a sensibility label of you choice that is set on the workbook in sample 1.
-
_protectedSampleFile - The path to a protected excel file that will be read and updated by EPPlus in sample 2, to demonstrate how to work with files protected by sensibility labels.
EPPlus Software AB - https://epplussoftware.com
- What is new in EPPlus 5+
- Breaking Changes in EPPlus 5
- Breaking Changes in EPPlus 6
- Breaking Changes in EPPlus 7
- Addressing a worksheet
- Dimension/Used range
- Copying ranges/sheets
- Insert/Delete
- Filling ranges
- Sorting ranges
- Taking and skipping columns/rows
- Data validation
- Comments
- Freeze and Split Panes
- Header and Footer
- Autofit columns
- Grouping and Ungrouping Rows and Columns
- Formatting and styling
- Conditional formatting
- Using Themes
- Working with custom named table- or slicer- styles