Forum Discussion
Daniel Westerdale
Jul 23, 2019Iron Contributor
Setting Retention Labels on OneDrive Folder items.
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 -FolderSi...
- Jul 24, 2019
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 https://sharepoint.stackexchange.com/questions/35571/caml-query-to-get-listitem-by-name-field. 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
Daniel Westerdale
Jul 24, 2019Iron Contributor
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 https://sharepoint.stackexchange.com/questions/35571/caml-query-to-get-listitem-by-name-field. 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