View all external users who have been granted access

Brass Contributor

(Edit to change title)

 

Hi all

 

A customer asked me how to view a list of all external users who have been granted access to a particualr library of document.

 

Having had a look around, I can't see any way to get this information.  Noting shows up inside SharePoint.

 

I was directed to the Sharing popup on the SIte Collections admin page, but that does not list any user assigments, it just lists the sharing status of the site collection, with a "Changes will be applied..." message at the bottom (slightly odd, that, since I have not asked for changes to be made).

 

Anyone have an answer?

 

 

8 Replies

@Andrew van Renen, I am not sure if this will help. But you can use this script to get permission details for selected document library. HTH. 

 

Param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[string] $Username,
[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)]
[string] $Password,
[Parameter(Position=2, Mandatory=$true, ValueFromPipeline=$true)]
[string] $Site,
[Parameter(Position=3, Mandatory=$true, ValueFromPipeline=$true)]
[string] $Library
)

Function Main
{
#Add references to SharePoint client assemblies and authenticate to Office 365 site – required for CSOM
Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client").location)
Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.runtime").location)

#Bind to site collection
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$(convertto-securestring $Password -asplaintext -force))
$ctx.Credentials = $creds

#Retrieve list
$list = $ctx.Web.Lists.GetByTitle($Library)
$ctx.Load($list)
$ctx.ExecuteQuery()

#Get User's permission in the list
$listRoleAssignments = $List.RoleAssignments
$ctx.Load($listRoleAssignments)
$ctx.ExecuteQuery()

$rec=@()
Foreach($assignment in $listRoleAssignments)
{
$userPermission=$assignment.RoleDefinitionBindings
$memberName=$assignment.Member
$ctx.Load($memberName)
$ctx.Load($userPermission)
$ctx.ExecuteQuery()
$extUserDetails = "" | Select "UserName","Loginname", "Permission"
$userLoginName=$membername.LoginName.ToString()

if($userLoginName -like '*#ext#*')
{
$extUserDetails.Loginname =$userLoginName
$extUserDetails.UserName = $memberName.Title
$extUserDetails.Permission = $UserPermission.name
$rec+= $extUserDetails
}
}
#List out for all External Username with Permission
Write-Host "Total number of External users :" $rec.Count
Write-Host "All External users with Permission details.."
Write-Host "-----------------------------------------------"
$rec
}

Main-Username <Name> -Password <Password>-Site <SiteURL> -Library <document library name>

Thanks Santhosh

 

I hadn't looked down the PowerShell route, but that is a handy script.  Unfortunately, my client is small company with a single IT person who is a long way from being able to run O365 PowerShell.

 

According to the documentation, you are supposed to be able to see this information in the Admin panel - it just looks like there is a bug at the moment.  Unless other people are able to seet theirs?

You can able to see external users for each site collection from old admin center. Navigate to External Sharing > Sites. See below screenshot. 

 

224.png

aaagh - caught again. These (non-identical) twin portal are such a pain - Azure as well (though at least with Azure the new portal will usually redirect you to the old portal if there is an option it does not support).

Thanks Santhosh. Really appreciate this.
Hi,
Do you know how can we do this with the new modern theme?
I want to know who is sharing files with external people.
The only list I found is on the Admin Center / "invited users" but there isn't any information about which files has access every user.
Many thanks

@Andrew van Renen @Alvaro Llobet 

Unfortunately, this only works per site but it's the most useful I could find.

According to this, you:

  1. Log in to SharePoint Online site as an administrator of the site
  2. Navigate to Site Content pages from Gear button (top top right, sometimes it takes some time to load) -> then click Site Contents from the menu
    stijnijn_1-1604936704007.jpeg
  3. Click the Site Usage button in the command bar in the Site Contents page, to navigate to the Site usage page
    stijnijn_2-1604936730030.jpeg
  4. Scroll down to 'Shared with external users', there you can see who has access. Also you can 'Run report' and get an .xlsx summary
    stijnijn_3-1604936785702.png

     

The "Run report" button does not appear in all sites I am a member of. The list of files does appear though. What causes this? What rights is the button depending on?

@ci3nai I could be wrong but I believe you have to be a site / global admin rather than a site owner for the button to appear. 

Though tbh I am unfortunately very used to inconsistences between what is available depending on user admin level and licence level of various functions. 


Sorry I can't be of more help.