Dismiss Notice

Register now to be one of the first members of this SharePoint Community! Click here it just takes seconds!

Dismiss Notice
Welcome Guest from Country Flag

Copy-PnPFile into subfolder of same library

Discussion in 'SharePoint Blogs' started by /u/pooot_, Aug 16, 2019.

Thread Status:
Not open for further replies.
  1. /u/pooot_

    /u/pooot_ Guest

    Blog Posts:
    0
    Hello!

    I'm having trouble copying a file with Copy-PnPFile, I keep getting access denied errors when trying to copy a file into a subfolder in the same document library. Copying into the same folder as the template works fine.
    I've tried every combination of $targetDir I can think of without success... $targetDir is manually created, and I can copy files in browser. The account I'm using is a global admin.

    Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/Site-Name" -UseWebLogin $OriginalFilePath = "LibraryName/Template.xlsx" $TargetDir = "LibraryName/YYMM/Copy.xlsx" // Doesn't work, access denied $TargetDir = "/sites/Site-Name/LibraryName/YYMM/Username.xlsx" // Doesn't work, access denied $TargetDir = "LibraryName/Copy.xlsx" // Works Copy-PnPFile -SourceUrl $OriginalFilePath -TargetUrl "$($TargetDir)/$($User.Name).xlsx"

    Bonus question:
    Is there a way to set multiple permissions for a list item without multiple Set-PnPListItemPermission calls? Seems unnecessary and slow to call it 4+ times...

    submitted by /u/pooot_
    [link] [comments]

    Continue reading...
     
Thread Status:
Not open for further replies.

Share This Page

LiveZilla Live Chat Software