0

I would like to update all files on a site.

I can collect the files I want:

$files = Find-PnPFile "TEST.XML" -Web $web

foreach ($file in $files)
{
 #here I make changes
 ...
 #and would like to upload
 Upload(?)
}

I would like to make changes to every file in the search results and upload to where it came from. The problem is that the Add-PnPFile function needs the document library parameter. Is there any way to retrieve this from the file object returned by the search? The returned Microsoft.SharePoint.Client.File object has a ListId property, but that is empty. Or, is there any other way to upload a file using the url only, that is available via the ServerRelativeUrl property.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.