Thursday, September 22, 2016

Removing an External user from SharePoint Online using SharePoint Online management Shell:


1

This post discusses about the steps that are supposed to be followed to remove an external user from SharePoint Online (Office 365). An external user is one who’s not a part of your domain (meaning his/her user account won’t be present in your on-premises Active Directory which later got synced with Azure AD nor would be present on Azure AD alone). To be more elaborative…An external user is someone outside your organization (i.e. domain) who can access your SharePoint Online sites and documents but does not have a proper license assigned to him to access SharePoint Online or any other Microsoft Office 365 services. These so called “External users” are not employees, contractors, or onsite agents for you or your affiliates.

External users inherit the use rights of the SharePoint Online customer who is inviting them to collaborate. For example, if an organization purchases an E3/E5 Enterprise plan, and builds a site that uses enterprise features, the external user is granted rights to use and/or view the enterprise features within the site they are invited to. While external users can be invited as extended project members to perform a full range of actions on a site, they will not have the exact same capabilities as a full, paid, licensed member within your organization.


So let’s take a look at the steps to remove an external user using SharePoint Online Management Shell…

Note: Before proceeding further, make sure you have installed and configured SharePoint Online management shell in your PC. I’ve created a post on that and please check this link to access that.

  1. Start the SharePoint Online Management Shell.
  2. Type the following cmdlet:

$credential   Get-Credential

Once you enter this cmdlet you would get a windows dialog box asking for your Office 365 credentials, please enter your credentials and then validate it by using the $credential cmdlet . This will return the UPN with which you signed in.

2.png

3. Once done, run the below mentioned cmdlet to connect to your SharePoint Online tenant.

Connect-SPOService -Url http://ift.tt/2cCZaKb -Credential (Get-Credential)

3.png

  1. Get the external user’s information (i.e. the one whom you want to remove) by running the below mentioned cmdlet.

 $user = Get-SPOExternalUser -Filter user@domain.no  #Provide the email address of the user

4.png

 5. Now once you have retrieved the external user’s information run the below mentioned cmdlet to remove the user as shown below

 Remove-SPOExternalUser -UniqueIDs @($user.UniqueId)

Click Y to confirm to remove user as shown in the screen-shot below.

5

 6. Once done, in order to remove the user from all the SharePoint Online site collections you need to run the below mentioned cmdlet. Please note that this command has to be ran for all the site collections where the user has been granted access to.

Get-SPOUser –Site http://ift.tt/2cCZ3Ov -LoginName alan_eric-nolen.no#ext#@365vignesh.onmicrosoft.com

Here the login name is what you get when you search for this user on “Manage user profiles”section in SharePoint admin center.

6

7. Now remove the external user using the below mentioned cmdlet.

Remove-SPOUser -Site http://ift.tt/2cCZ3Ov  LoginNamealan_eric-nolen.no#ext#@365vignesh.onmicrosoft.com

7

8. You can verify whether the user has been removed successfully by running the “Get-SPOUser” that we ran in the previous step and it should return an error stating that the user cannot be found. This confirms that the user has been removed successfully.

9. Now in addition to all the above mentioned steps you need to remove the user from the UserInfo list as well so that the user doesn’t show up in the people picker field when you search for that user. For that go to the site collection URL in question and edit the URL by adding the following string to the end of it.

_layouts/15/http://ift.tt/2cCtD7T

 For example if the site collection name is https://<vignesh&gt;.sharepoint.com then this is how you need to edit the URL by adding the string.

https://<vignesh&gt;http://.sharepoint.com/_layouts/15/people.aspx/membershipGroupId=0

10. Finally, once the user has been removed from SharePoint Online as well as the site collection in question, the external user’s profile will still show up under “Manage user profiles” section in SharePoint admin center. This is quite normal and please wait for SharePoint Online to remove the user’s profile from the SharePoint admin center. This task will take couple of hours and hence please check the status of that user’s account in SharePoint Online admin center after few hours .You would notice that the user’s profile has been removed successfully.

8.png

11. Once you have confirmed that the user’s account has been removed successfully, you need to clear the browser cache. Please note that SharePoint Online uses browser caching in several scenarios, including the People Picker. Even though a user was fully removed from the system, he or she may still remain in the browser cache. Clearing the browser cache should resolve this issue

Thanks for reading this post ….Happy SharePointing!!!


by Vignesh Ganesan via Everyone's Blog Posts - SharePoint Community

No comments:

Post a Comment