SOLVED

Automatically applying labels to sites/site collections

%3CLINGO-SUB%20id%3D%22lingo-sub-97179%22%20slang%3D%22en-US%22%3EAutomatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-97179%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20is%20possible%20to%20automatically%20assign%20labels%20to%20all%20documents%20in%20a%20SharePoint%20document%20library.%20I%20want%20to%20take%20it%20a%20step%20further%20and%20assign%20labels%20(e.g.%20%22Confidential%22)%20to%20all%20documents%20in%20a%20site%2C%20no%20matter%20what%20document%20library%20they%20are%20stored%20in.%20Is%20that%20possible%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%3A%20A%20site%20is%20enabled%20for%20external%20access%20by%20guest%20users%20and%20the%20site%20owner%20has%20declared%20that%20the%20site%20may%20contain%20confidential%20contents.%20All%20documets%20uploaded%20to%20or%20created%20in%20this%20site%20will%20therefore%20automatically%20be%20assigned%20the%20%22Confidential%22%20label.%20This%20behavior%20cannot%20be%20altered%20by%20the%20site%20owner.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20it%20would%20be%20nice%20if%20content%20that%20are%20assigned%20a%20specific%20label%2C%20automatically%26nbsp%3Bgets%20assigned%20a%20set%20of%20policies%20that%20prevent%20certain%20actions%20like%20download%2C%20printing%20ect.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20another%20thing%20-%20it%20would%20also%20be%20nice%20if%20it%20was%20possible%20to%20specify%20that%20all%20site%20collections%20that%20have%20enabled%20external%26nbsp%3Baccess%20always%20automatically%20will%20be%20assigned%20a%20set%20of%20policies%20that%20restrict%20the%20actions%20possible%20on%20the%20contents.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20any%20of%20this%20possible%20via%20PowerShell%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20thoughts%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EJakob%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-97179%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECompliance%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDLP%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Elabels%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236199%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236199%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Esee%20the%20blog%20about%20%22%3CSPAN%3EConfiguring%20default%20Office%20365%20Labels%20using%20PowerShell%22%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.myfatblog.co.uk%2Findex.php%2F2018%2F05%2Fconfiguring-default-office-365-labels-using-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.myfatblog.co.uk%2Findex.php%2F2018%2F05%2Fconfiguring-default-office-365-labels-using-powershell%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EToday%20is%20one%20and%20the%20only%20way%20you%20can%20do%20this%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAndreas%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-155039%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-155039%22%20slang%3D%22en-US%22%3E%3CP%3E%22*%22%20is%20not%20a%20valid%20search%20keyword.%20I%20don't%20think%20you%20can%20use%20it%20to%20search%20for%20everything%20(at%20least%2C%20I%20couldn't%20just%20now).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20users%20always%20have%20the%20ability%20to%20override%20auto-applied%20labels.%20The%20logic%20here%20is%20that%20people%20know%20better%20than%20computers%20how%20important%20content%20is.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-154968%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-154968%22%20slang%3D%22en-US%22%3E%3CP%3EWith%20Auto-apply%20label%2C%20can%20we%20use%20a%20wildcard%20%22*%22%20with%20the%20option%20of%20%22%3CSPAN%3EApply%20label%20to%20content%20that%20contains%20specific%20words%20or%20phrases%22%3F%20This%20is%20required%20to%20blanket%26nbsp%3BSharePoint%20to%20have%20the%20base%20retention%20policy%20in%20place.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAnd%20if%20that%20is%20possible%2C%20would%20the%20user%20able%20to%20selectively%20change%20the%20labels%20on%20the%20documents%20which%20were%20auto-applied%20by%20the%20wildcard%20rule%3F%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-142098%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-142098%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20classification%20label%20is%20known%20as%20the%20compliancetag%20in%20terms%20of%20the%20schema%2C%20so%20I%20guess%20you%20can%20use%20whatever%20tool%20you%20like%20to%20interact%20with%20documents%20(I%20don't%20do%20this%2C%20so%20I%20can't%20advise%20-%20maybe%20some%20of%20the%20SharePoint%20gurus%20can%20say%20what's%20best).%20You%20can%20also%20define%20a%20default%20label%20for%20a%20library%20to%20make%20sure%20that%20all%20existing%20and%20new%20documents%20get%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-142096%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-142096%22%20slang%3D%22en-US%22%3E%3CP%3EDo%20you%20know%20how%20to%20set%20default%20label%20for%20document%20library%20through%20code%3F%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3E%20wrote%3A%3CBR%20%2F%3E%3CP%3EAuto-label%20policies%20are%20the%20only%20automatic%20method%2C%20but%20you'd%20have%20to%20be%20able%20to%20identify%20the%20target%20documents%20with%20a%20keyword.%20I%20think%20you%20might%20have%20to%20edit%20the%20settings%20of%20each%20library%20to%20set%20the%20right%20label%20as%20the%20default%20for%20all%20existing%20and%20new%20documents.%3C%2FP%3E%0A%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-102553%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-102553%22%20slang%3D%22en-US%22%3E%3CP%3EAuto-label%20policies%20are%20the%20only%20automatic%20method%2C%20but%20you'd%20have%20to%20be%20able%20to%20identify%20the%20target%20documents%20with%20a%20keyword.%20I%20think%20you%20might%20have%20to%20edit%20the%20settings%20of%20each%20library%20to%20set%20the%20right%20label%20as%20the%20default%20for%20all%20existing%20and%20new%20documents.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-102550%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-102550%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F64%22%20target%3D%22_blank%22%3E%40Tony%20Redmond%3C%2FA%3Edo%20you%20know%20if%20there%20is%20a%20way%20to%20automatically%20enable%20the%20classification%20labels%20in%20many%20libraries%20that%20have%20been%20migrated%20from%20SP%20on-premises%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-97202%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-97202%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20answer%20is%20yes.%20What%20you're%20looking%20for%20are%20classification%20labels%20(see%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.petri.com%2Foffice-365-data-governance%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.petri.com%2Foffice-365-data-governance%3C%2FA%3E).%20You%20can%20apply%20these%20to%20a%20document%20library%20in%20three%20ways%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Make%20it%20the%20default%20that%20a%20label%20applies%20to%20all%20items%20in%20the%20library%20(and%20sub-folders).%3C%2FP%3E%3CP%3E2.%20Select%20each%20item%20and%20add%20the%20appropriate%20label.%3C%2FP%3E%3CP%3E3.%20Use%20an%20auto-label%20policy%20to%20find%20the%20documents%20you%20want%20to%20protect%20and%20apply%20a%20label.%20This%20requires%20E5%20licenses.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20suspect%20that%20option%201%20is%20what%20you%20need.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20Dean's%20point%2C%20a%20gap%20currently%20exists%20between%20Office%20365%20classification%20labels%20and%20those%20used%20by%20Azure%20Information%20Protection%20(AIP).%20I%20suspect%2C%20but%20don't%20know%2C%20that%20the%20gap%20will%20close%20and%20we%20might%20hear%20about%20this%20at%20Ignite.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-97196%22%20slang%3D%22en-US%22%3ERe%3A%20Automatically%20applying%20labels%20to%20sites%2Fsite%20collections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-97196%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20are%202%20types%20of%20labels%3A%20Office%20365%20labels%20and%20Azure%20Information%20Protection%20labels.%20Which%20one%20do%20you%20want%20to%20apply%3F%20The%20long%20term%20purpose%20will%20help%20to%20determine%20the%20appropriate%20type.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20automatically%20apply%20Azure%20IP%20labels%20to%20files%20that%20contain%20specific%20contents%2C%20see%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Finformation-protection%2Fdeploy-use%2Fconfigure-policy-classification%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Finformation-protection%2Fdeploy-use%2Fconfigure-policy-classification%3C%2FA%3E%20(this%20does%20require%20the%20Azure%20Information%20Protection%20Premium%20P2%20license%2C%20which%20is%20available%20throught%20the%20EMS%20E5%20package).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

It is possible to automatically assign labels to all documents in a SharePoint document library. I want to take it a step further and assign labels (e.g. "Confidential") to all documents in a site, no matter what document library they are stored in. Is that possible?

 

Example: A site is enabled for external access by guest users and the site owner has declared that the site may contain confidential contents. All documets uploaded to or created in this site will therefore automatically be assigned the "Confidential" label. This behavior cannot be altered by the site owner.

 

Also, it would be nice if content that are assigned a specific label, automatically gets assigned a set of policies that prevent certain actions like download, printing ect.

 

And another thing - it would also be nice if it was possible to specify that all site collections that have enabled external access always automatically will be assigned a set of policies that restrict the actions possible on the contents.

 

Is any of this possible via PowerShell?

 

Any thoughts? 

 

Thanks

Jakob

 

9 Replies
Highlighted

There are 2 types of labels: Office 365 labels and Azure Information Protection labels. Which one do you want to apply? The long term purpose will help to determine the appropriate type. 

 

You can automatically apply Azure IP labels to files that contain specific contents, see https://docs.microsoft.com/en-us/information-protection/deploy-use/configure-policy-classification (this does require the Azure Information Protection Premium P2 license, which is available throught the EMS E5 package). 

 

Highlighted
Best Response confirmed by Tony Redmond (MVP)
Solution

The answer is yes. What you're looking for are classification labels (see https://www.petri.com/office-365-data-governance). You can apply these to a document library in three ways:

 

1. Make it the default that a label applies to all items in the library (and sub-folders).

2. Select each item and add the appropriate label.

3. Use an auto-label policy to find the documents you want to protect and apply a label. This requires E5 licenses.

 

I suspect that option 1 is what you need.

 

To Dean's point, a gap currently exists between Office 365 classification labels and those used by Azure Information Protection (AIP). I suspect, but don't know, that the gap will close and we might hear about this at Ignite.

@Tony Redmonddo you know if there is a way to automatically enable the classification labels in many libraries that have been migrated from SP on-premises? 

Highlighted

Auto-label policies are the only automatic method, but you'd have to be able to identify the target documents with a keyword. I think you might have to edit the settings of each library to set the right label as the default for all existing and new documents.

Highlighted

Do you know how to set default label for document library through code? 


@Tony Redmond wrote:

Auto-label policies are the only automatic method, but you'd have to be able to identify the target documents with a keyword. I think you might have to edit the settings of each library to set the right label as the default for all existing and new documents.


 

Highlighted

The classification label is known as the compliancetag in terms of the schema, so I guess you can use whatever tool you like to interact with documents (I don't do this, so I can't advise - maybe some of the SharePoint gurus can say what's best). You can also define a default label for a library to make sure that all existing and new documents get it.

Highlighted

With Auto-apply label, can we use a wildcard "*" with the option of "Apply label to content that contains specific words or phrases"? This is required to blanket SharePoint to have the base retention policy in place.

 

And if that is possible, would the user able to selectively change the labels on the documents which were auto-applied by the wildcard rule? 

Highlighted

"*" is not a valid search keyword. I don't think you can use it to search for everything (at least, I couldn't just now).

 

And users always have the ability to override auto-applied labels. The logic here is that people know better than computers how important content is.

Highlighted

Hi all,

 

see the blog about "Configuring default Office 365 Labels using PowerShell" 

 

http://www.myfatblog.co.uk/index.php/2018/05/configuring-default-office-365-labels-using-powershell/

 

Today is one and the only way you can do this

 

Andreas