Tuesday, 19 April 2016

Get external users list in Sharepoint Online using Powershell

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.
Connect-SPOService -Url https://mytenant-admin.sharepoint.com -credential admin@mytenant.com
The below command retutns all the external users in sharepoint online tenant.
You 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 20
The below command returns first 20 external users from second page.
Get-SPOExternalUser -Position 1 -PageSize 20
You 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 admin
You 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


1 comment:

  1. Awesome! Its actually remarkable article, I have got much clear idea on the topic of from this post.