Forum Discussion
vassp1980
Nov 25, 2024Copper Contributor
How do I apply retention label to a folder in a SharePoint library?
Hello All,
Can you please advice how do I apply a "Retention label" (Created in M365 compliance centre) to folders in a Document Library?
I created this retention label below
I published this label and it now appears in document library, but at a individual document level as shown below
I am not sure how to make the same appear at a folder level.
Note : In the actual customer scenario, they would like different retention labels to be applied to different "folders" (ie, users should be able to apply retention labels to folders, so that the documents inside those folders follow the label applied at folder level).
For achieving this, I heard that we only need to create a retention label (not retention policy) as we are looking at a "Folder" level here (not site level or up). However I am not sure how to do it.
Please advice.
- iu360Copper Contributor
Hello
thank you i have same issue but i solve this issue Did you use SharePoint search to check the syntax? I have found that documentlink queries need a terminating "/*" to work. If the search syntax doesn't work with SharePoint search, you'll waste a lot of time waiting for the auto-label policy to fail because it can't find anything.
- vassp1980Copper Contributor
Hi thanks for reply.
This is strange. When I type in the following in a separate browser tab, it does load the finance folder directly :
https://psmodernworkplace.sharepoint.com/sites/VasModernWorkplaceTeamsSite/Working%20Documents/Finance/But neither of the below works when pasting in sharepoint search :
(documentlink:"https://psmodernworkplace.sharepoint.com/sites/VasModernWorkplaceTeamsSite/Working%20Documents/Finance/*")
documentlink:"https://psmodernworkplace.sharepoint.com/sites/VasModernWorkplaceTeamsSite/Working%20Documents/Finance"
All I get is this when i searchDoes the signed in user have access to the target site? You must be a member of the site for SharePoint search to work.
Things are different when you run a content search because administrative permissions are used to search the site.
Should be doable. Select the folder > open the detail pane > locate the Label dropdown and select the desired label therein:
Sensitivity labels on the other hand should not be available on the folder level, just on individual items.
- vassp1980Copper Contributor
Hi
That worked.
I also needed to apply auto labelling policy based on a certain condition.
Condition --> When a folder name is "Finance", then auto apply the label "Indefinite" to the folder (and it's items inside it).
So I Created a "auto apply label" and selected this retention label "indefinite" to it. I am having trouble writing the CONDITION which actually looks for folder named "Finance". Can you help me with that?I searched up various resources but can't find a single video or resource which explains how to write the above condition to apply a label when a folder name is matching a name mentiond in a query. Here is the auto label policy I am trying out
This is what some of the resources in web suggested, but I am not sure it works.
The above policy si active, but I can't see the auto label applied to the folder, or any document inside the Finance folder (See below). Is there a issue with the syntax?
Try the DocumentLink property as detailed here: https://learn.microsoft.com/en-us/purview/ediscovery-keyword-queries-and-search-conditions#searchable-site-properties
- vassp1980Copper Contributor
Hi Buddy, thanks will check and let you know
KeyQL queries like:
documentlink:'https://office365itpros.sharepoint.com/sites/companyforum/Shared Documents/Confidential/*' AND contenttype:document
Work well for finding just documents in a specific folder. To test them out, start the SharePoint browser app and paste the query in the search box. If it doesn't work there. it won't work elsewhere.