Jul 23 2019 08:23 AM - edited Jul 23 2019 11:39 PM
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
....
Jul 24 2019 02:43 AM
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
Jul 24 2019 02:43 AM
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