We can use the SharePoint Online powershell cmdlet Get-SPOExternalUser to get a list of external users who has access to view or edit one of your site. This cmdlet can return external users in whole tenant or external users only belong to a specific site. Before proceed, run the following command to connect sharepoint online powershell module.
The following command returns the first 20 users whose name or email start with the string 'admin'.
Connect-SPOService -Url https://mytenant-admin.sharepoint.com -credential admin@mytenant.comThe below command retutns all the external users in sharepoint online tenant.
Get-SPOExternalUserYou can set PageSize to specify the maximum number of users to be returned in the collection. The value must be less than or equal to 50. The below command returns first 20 external users in the collection
Get-SPOExternalUser -Position 0 -PageSize 20The below command returns first 20 external users from second page.
Get-SPOExternalUser -Position 1 -PageSize 20You can use filter option with this cmdlet to limit the results to only those users whose first name, last name or email address begins with the text in the string.
The following command returns the first 20 users whose name or email start with the string 'admin'.
Get-SPOExternalUser -Position 0 -PageSize 20 -Filter adminYou can get external users for a specific site by setting the siteurl with Get-SPOExternalUser cmdlet.
Get-SPOExternalUser -SiteUrl https://mytenant.sharepoint.com/sites/contosobeta
Awesome! Its actually remarkable article, I have got much clear idea on the topic of from this post.
ReplyDelete