4

I want to generate a report of every document and permissions on it. Permissions contains General Permission and Users who have permission through a sharing link/ or external sharing link. When I run a code I get a result like "SharingLinks.fdbe4441-98ec-47f5-9795-78f8e6e826e9.OrganizationEdit.00e9b96f-8eb7-4a68-b162-f7accc9fec66 : Contribute" It means this document has been shared with Sharing Link having Contribute permission. Please see the Image below. It shows all the users having permission. But how can I get this info using Powershell script (PnP-Powershell) user permissions

2
  • Looking for a similar approach. All I can think so far is to grab all the items in a list and filter by the ones which has unique accessrules defined
    – Alberto S.
    Dec 26 '19 at 13:06
  • Did you manage to get PowerShell for your requirement? I have the same requirement and coudnt find any script
    – George
    Jun 4 '20 at 14:35
0
#$fileUrl -NewFolder/logo.png
$file = Get-PnPFile -Url $fileUrl -AsListItem

Get-PnPProperty -ClientObject $file -Property RoleAssignments
$members = Get-PnPProperty -ClientObject $roleAssignments -Property RoleDefinitionBindings, Member
$member = $roleAssignments.Member 
#list of users 
$Users = Get-PnPProperty -ErrorAction SilentlyContinue -ClientObject $member -Property Users 
#Return Accesstype
$accessType = $roleAssignments.RoleDefinitionBindings.Name;
   if ($member.Title -like "SharingLinks*") {
            if ($Users -ne $null) {
                $array = foreach ($user in $Users) {
                Write-host $user.LoginName, $accessType
                }
           }
    }

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.