0

I have a modern SharePoint site whose library has gone rogue and is no longer associated with the parent site (it's a long story). If I try to access this library, I get an error telling me I don't have permission to access it. But, since it's no longer available through the SharePoint UI, I'm thinking that PowerShell would provide a mechanism to assign permissions so I can access the files/folders in this ronin library. Then I could move the files to where they belong.

But ... I'm not that familiar with SharePoint at the level needed to create a script to do this. Anyone have any ideas about what such a script would look like? I just need to assign myself as a user to the library using its URL. Sounds easy unless you don't know how to do it.

Any ideas?

I've tried accessing this library via the SharePoint UI using its URL, but I don't have permission to do so. I can't assign permissions via the UI, so I'm thinking PowerShell might be the way to accomplish assigning of permissions to the library.

Mike E.
  • 1
  • 1

1 Answers1

0

It seems that the document library with unique permission compare with the site collection.

If you do not have access permission with this document library, then you cannot grant permission for this document library.

You should ask people with enough permission to grant permission by following PowerShell.

#Config Variables
$SiteURL = "https://tanant.sharepoint.com/sites/test"
$ListName ="testlist"
$UserID="user1@tenant.onmicrosoft.com"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
 
 
#Grant permission on List to User
Set-PnPListPermission -Identity $ListName -AddRole "Edit" -User $UserID
Emily Du - MSFT
  • 491
  • 3
  • 6