Forum Discussion
afierro97
Nov 02, 2023Copper Contributor
Rename-pnpFile gives me access denied with admin rights
Hello! I have problems renaming my files. I'm using these commands: #this is one command i tried
connect-pnponline -url "https://contoso.sharepoint.com/sites/Clients" -interactive -validateconnec...
luis-ribeiro
Nov 03, 2023Brass Contributor
Hi afierro97
I believe is not a permission issue. Use ServerRelativeUrl instead of SiteRelativeUrl and put the url of the file instead of the $file object.
Rename-PnPFile -ServerRelativeUrl "/sites/MySite/Shared Documents/myfolder/myfile.txt" -TargetFileName "renamedfile.txt" -Force -Verbose
afierro97
Nov 03, 2023Copper Contributor
Hi Luis,
I've tried that and gave me the same error.
Thanks for your help!
I believe too that is not a permission issue but i dont know what to do or how to debbug the error
I've tried that and gave me the same error.
Thanks for your help!
I believe too that is not a permission issue but i dont know what to do or how to debbug the error
- luis-ribeiroNov 03, 2023Brass Contributor
Hi afierro97
Just to make it clear, in your example "/sites/Clients/folder/subfolder/" note that folder should be the library url and then your folders
- afierro97Nov 03, 2023Copper ContributorYes, i've changed the names of the path for confidenciality but i've built the path like this:
"/sites/<name of the site>/<name of the library>/<folder>/<File.txt>"