View all external users who have been granted access

%3CLINGO-SUB%20id%3D%22lingo-sub-3966%22%20slang%3D%22en-US%22%3EView%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3966%22%20slang%3D%22en-US%22%3E%3CP%3E(Edit%20to%20change%20title)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20all%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20customer%20asked%20me%20how%20to%20view%20a%20list%20of%20all%20external%20users%20who%20have%20been%20granted%20access%20to%20a%20particualr%20library%20of%20document.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHaving%20had%20a%20look%20around%2C%20I%20can't%20see%20any%20way%20to%20get%20this%20information.%26nbsp%3B%20Noting%20shows%20up%20inside%20SharePoint.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20directed%20to%20the%20Sharing%20popup%20on%20the%20SIte%20Collections%20admin%20page%2C%20but%20that%20does%20not%20list%20any%20user%20assigments%2C%20it%20just%20lists%20the%20sharing%20status%20of%20the%20site%20collection%2C%20with%26nbsp%3Ba%20%22Changes%20will%20be%20applied...%22%20message%20at%20the%20bottom%20(slightly%20odd%2C%20that%2C%20since%20I%20have%20not%20asked%20for%20changes%20to%20be%20made).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnyone%20have%20an%20answer%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3966%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-67991%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-67991%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EDo%20you%20know%20how%20can%20we%20do%20this%20with%20the%20new%20modern%20theme%3F%3CBR%20%2F%3EI%20want%20to%20know%20who%20is%20sharing%20files%20with%20external%20people.%3CBR%20%2F%3EThe%20only%20list%20I%20found%20is%20on%20the%20Admin%20Center%20%2F%20%22invited%20users%22%20but%20there%20isn't%20any%20information%20about%20which%20files%20has%20access%20every%20user.%3CBR%20%2F%3EMany%20thanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-4771%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-4771%22%20slang%3D%22en-US%22%3Eaaagh%20-%20caught%20again.%20These%20(non-identical)%20twin%20portal%20are%20such%20a%20pain%20-%20Azure%20as%20well%20(though%20at%20least%20with%20Azure%20the%20new%20portal%20will%20usually%20redirect%20you%20to%20the%20old%20portal%20if%20there%20is%20an%20option%20it%20does%20not%20support).%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20Santhosh.%20Really%20appreciate%20this.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-4608%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-4608%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20able%20to%20see%20external%20users%20for%20each%20site%20collection%20from%20old%20admin%20center.%20Navigate%20to%20External%20Sharing%20%26gt%3B%20Sites.%20See%20below%20screenshot.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F1618i6731C7781771DC96%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22224.png%22%20title%3D%22224.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-4598%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-4598%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Santhosh%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hadn't%20looked%20down%20the%20PowerShell%20route%2C%20but%20that%20is%20a%20handy%20script.%26nbsp%3B%20Unfortunately%2C%20my%20client%20is%20small%20company%20with%20a%20single%20IT%20person%20who%20is%26nbsp%3Ba%20long%20way%20from%20being%20able%20to%20run%20O365%20PowerShell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAccording%20to%20the%20documentation%2C%20you%20are%20supposed%20to%20be%20able%20to%20see%20this%20information%20in%20the%20Admin%20panel%20-%20it%20just%20looks%20like%20there%20is%20a%20bug%20at%20the%20moment.%26nbsp%3B%20Unless%20other%20people%20are%20able%20to%20seet%20theirs%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-4256%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-4256%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2323%22%20target%3D%22_blank%22%3E%40Andrew%20van%20Renen%3C%2FA%3E%2C%20I%20am%20not%20sure%20if%20this%20will%20help.%20But%20you%20can%20use%20this%20script%20to%20get%20permission%20details%20for%20selected%20document%20library.%20HTH.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EParam(%3CBR%20%2F%3E%5BParameter(Position%3D0%2C%20Mandatory%3D%24true%2C%20ValueFromPipeline%3D%24true)%5D%3CBR%20%2F%3E%5Bstring%5D%20%24Username%2C%3CBR%20%2F%3E%5BParameter(Position%3D1%2C%20Mandatory%3D%24true%2C%20ValueFromPipeline%3D%24true)%5D%3CBR%20%2F%3E%5Bstring%5D%20%24Password%2C%3CBR%20%2F%3E%5BParameter(Position%3D2%2C%20Mandatory%3D%24true%2C%20ValueFromPipeline%3D%24true)%5D%3CBR%20%2F%3E%5Bstring%5D%20%24Site%2C%3CBR%20%2F%3E%5BParameter(Position%3D3%2C%20Mandatory%3D%24true%2C%20ValueFromPipeline%3D%24true)%5D%3CBR%20%2F%3E%5Bstring%5D%20%24Library%3CBR%20%2F%3E)%3C%2FP%3E%3CP%3EFunction%20Main%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%23Add%20references%20to%20SharePoint%20client%20assemblies%20and%20authenticate%20to%20Office%20365%20site%20%E2%80%93%20required%20for%20CSOM%3CBR%20%2F%3EAdd-Type%20-Path%20(%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SharePoint.Client%22).location)%3CBR%20%2F%3EAdd-Type%20-Path%20(%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SharePoint.Client.runtime%22).location)%3C%2FP%3E%3CP%3E%23Bind%20to%20site%20collection%3CBR%20%2F%3E%24ctx%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24Site)%3CBR%20%2F%3E%24creds%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24Username%2C%24(convertto-securestring%20%24Password%20-asplaintext%20-force))%3CBR%20%2F%3E%24ctx.Credentials%20%3D%20%24creds%3C%2FP%3E%3CP%3E%23Retrieve%20list%3CBR%20%2F%3E%24list%20%3D%20%24ctx.Web.Lists.GetByTitle(%24Library)%3CBR%20%2F%3E%24ctx.Load(%24list)%3CBR%20%2F%3E%24ctx.ExecuteQuery()%3C%2FP%3E%3CP%3E%23Get%20User's%20permission%20in%20the%20list%3CBR%20%2F%3E%24listRoleAssignments%20%3D%20%24List.RoleAssignments%3CBR%20%2F%3E%24ctx.Load(%24listRoleAssignments)%3CBR%20%2F%3E%24ctx.ExecuteQuery()%3C%2FP%3E%3CP%3E%24rec%3D%40()%3CBR%20%2F%3EForeach(%24assignment%20in%20%24listRoleAssignments)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%24userPermission%3D%24assignment.RoleDefinitionBindings%3CBR%20%2F%3E%24memberName%3D%24assignment.Member%3CBR%20%2F%3E%24ctx.Load(%24memberName)%3CBR%20%2F%3E%24ctx.Load(%24userPermission)%3CBR%20%2F%3E%24ctx.ExecuteQuery()%3CBR%20%2F%3E%24extUserDetails%20%3D%20%22%22%20%7C%20Select%20%22UserName%22%2C%22Loginname%22%2C%20%22Permission%22%3CBR%20%2F%3E%24userLoginName%3D%24membername.LoginName.ToString()%3C%2FP%3E%3CP%3Eif(%24userLoginName%20-like%20'*%23ext%23*')%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%24extUserDetails.Loginname%20%3D%24userLoginName%3CBR%20%2F%3E%24extUserDetails.UserName%20%3D%20%24memberName.Title%3CBR%20%2F%3E%24extUserDetails.Permission%20%3D%20%24UserPermission.name%3CBR%20%2F%3E%24rec%2B%3D%20%24extUserDetails%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%23List%20out%20for%20all%20External%20Username%20with%20Permission%3CBR%20%2F%3EWrite-Host%20%22Total%20number%20of%20External%20users%20%3A%22%20%24rec.Count%3CBR%20%2F%3EWrite-Host%20%22All%20External%20users%20with%20Permission%20details..%22%3CBR%20%2F%3EWrite-Host%20%22-----------------------------------------------%22%3CBR%20%2F%3E%24rec%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3EMain-Username%20%3CNAME%3E%20-Password%20%3CPASSWORD%3E-Site%20%3CSITEURL%3E%20-Library%20%3CDOCUMENT%20library%3D%22%22%20name%3D%22%22%3E%3C%2FDOCUMENT%3E%3C%2FSITEURL%3E%3C%2FPASSWORD%3E%3C%2FNAME%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1867390%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1867390%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2323%22%20target%3D%22_blank%22%3E%40Andrew%20van%20Renen%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F54393%22%20target%3D%22_blank%22%3E%40Alvaro%20Llobet%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnfortunately%2C%20this%20only%20works%20per%20site%20but%20it's%20the%20most%20useful%20I%20could%20find.%3C%2FP%3E%3CP%3EAccording%20to%20%3CA%20href%3D%22https%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fhow-to-manage-externally-shared-contents-in-sharepoint-online%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ethis%3C%2FA%3E%2C%20you%3A%3C%2FP%3E%3COL%3E%3CLI%3ELog%20in%20to%20SharePoint%20Online%20site%20as%20an%20administrator%20of%20the%20site%3C%2FLI%3E%3CLI%3ENavigate%20to%20Site%20Content%20pages%20from%20Gear%20button%20(top%20top%20right%2C%20sometimes%20it%20takes%20some%20time%20to%20load)%20-%26gt%3B%20then%20click%20Site%20Contents%20from%20the%20menu%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22stijnijn_1-1604936704007.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F232344i67F5248ED18868B8%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22stijnijn_1-1604936704007.jpeg%22%20alt%3D%22stijnijn_1-1604936704007.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3EClick%20the%20Site%20Usage%20button%20in%20the%20command%20bar%20in%20the%20Site%20Contents%20page%2C%20to%20navigate%20to%20the%20Site%20usage%20page%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22stijnijn_2-1604936730030.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F232345i5116DE1E22F1DEB6%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22stijnijn_2-1604936730030.jpeg%22%20alt%3D%22stijnijn_2-1604936730030.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3EScroll%20down%20to%20'Shared%20with%20external%20users'%2C%20there%20you%20can%20see%20who%20has%20access.%20Also%20you%20can%20'Run%20report'%20and%20get%20an%20.xlsx%20summary%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22stijnijn_3-1604936785702.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F232346iE6CD6A5ACB4F4A5C%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22stijnijn_3-1604936785702.png%22%20alt%3D%22stijnijn_3-1604936785702.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1952851%22%20slang%3D%22en-US%22%3ERe%3A%20View%20all%20external%20users%20who%20have%20been%20granted%20access%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1952851%22%20slang%3D%22en-US%22%3EThe%20%22Run%20report%22%20button%20does%20not%20appear%20in%20all%20sites%20I%20am%20a%20member%20of.%20The%20list%20of%20files%20does%20appear%20though.%20What%20causes%20this%3F%20What%20rights%20is%20the%20button%20depending%20on%3F%3C%2FLINGO-BODY%3E
Occasional 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?

 

 

7 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?