SOLVED

Setting Retention Labels on OneDrive Folder items.

%3CLINGO-SUB%20id%3D%22lingo-sub-769905%22%20slang%3D%22en-US%22%3ESetting%20Retention%20Labels%20on%20OneDrive%20Folder%20items.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-769905%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20in%20the%20process%20of%20reviewing%20the%20retention%20label%20of%20user's%20ODFB%20files%20after%20each%20file%20is%20restored%20from%20the%20Recycle%20bin%26nbsp%3B%20.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20locate%20my%20file%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%20%24f%20%3D%20Get-PnPFolderItem%20-FolderSiteRelativeUrl%20%22Documents%2FExpenses%22%20-ItemName%20%24filename%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20I%20am%20short%20changed%20here%20%3Aexpressionless_face%3A%3C%2Fimg%3E%2C%20as%20there%20are%20no%20SetComplianceTag%20methods%20available%2C%20as%20per%20Get-PnPListItem%20(see%20below)%20.%26nbsp%3B%20Hence%2C%20is%20there%20a%20clever%20way%20to%20locate%20this%20file%20and%20pipe%20the%20output%20to%20Get-PnPListItem%20%2C%20to%20allow%20me%20to%20access%20these%20methods.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESetComplianceTag%3C%2FP%3E%3CP%3ESetComplianceTagWithExplicitMetasUpdate%3C%2FP%3E%3CP%3ESetComplianceTagWithHold%3C%2FP%3E%3CP%3E....%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-769905%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Regular Contributor

 

Hi

 

I am in the process of reviewing the retention label of user's ODFB files after each file is restored from the Recycle bin  .

 

I can locate my file 

 

 $f = Get-PnPFolderItem -FolderSiteRelativeUrl "Documents/Expenses" -ItemName $filename

 

However, I am short changed here :expressionless_face:, as there are no SetComplianceTag methods available, as per Get-PnPListItem (see below) .  Hence, is there a clever way to locate this file and pipe the output to Get-PnPListItem , to allow me to access these methods.  

 

SetComplianceTag

SetComplianceTagWithExplicitMetasUpdate

SetComplianceTagWithHold

....

 

 

 

1 Reply
best response confirmed by Daniel Westerdale (Regular Contributor)
Solution

 

Update: remembered that James from @IDLive  had written a similar query in some auditing scripts, plus there a load of CAML examples out there to get a list item.  So real easy to create my query from these resources that worked first time (  a first for me =))

 

$query = "<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='File'>$filename</Value></Eq></Where></Query></View>"
$f = Get-PnPListItem -List Documents -Query $query