Forum Discussion
View all external users who have been granted access
(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?
- SanthoshB1Bronze Contributor
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>
- Andrew van RenenBrass Contributor
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?
- SanthoshB1Bronze Contributor
You can able to see external users for each site collection from old admin center. Navigate to External Sharing > Sites. See below screenshot.
- stijnijnCopper Contributor
Andrew van Renen Alvaro Llobet
Unfortunately, this only works per site but it's the most useful I could find.
According to this, you:
- Log in to SharePoint Online site as an administrator of the site
- 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
- Click the Site Usage button in the command bar in the Site Contents page, to navigate to the Site usage page
- Scroll down to 'Shared with external users', there you can see who has access. Also you can 'Run report' and get an .xlsx summary
- ci3naiCopper ContributorThe "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?
- hairy_marmiteCopper Contributor
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.