Organization wants to share their SharePoint online site collection, documents and collaborate with external partners, vendors or customers. By default site collection are shared to internal user’s only. But this can be extended to authenticated external users or also with limited sharing to anonymous users. External users do not have a license to office 365 subscription, they are limited to basic collaboration tasks.
I had recently enabled external access for site collection on the SPO tenant only to selected domains and authenticated external users. External sharing in SharePoint online works well in most scenario’s but there are few issues which pop up while enabling access for external user’s and with limited error details it becomes a bit challenging to understand the cause.
Error: “User Not in directory”
Error message which user’s get as they try to login to external SharePoint site is quiet generic ” User not in directory “it is not that descriptive and did not points to the cause for the issue.
To troubleshoot the access for the user. Clear browser cache or open Incognito or Private session, then try below steps.
First check to make sure the account which is used to accept the email invitation to the site is the same account which is being used to login later.
In Office 365 login screen if below screen is popping up prompting “Which account do you want to use?” when you sign in, it means that two different accounts have been configured with Microsoft using the same email address:
A “Work or school” account, which probably was created by your IT department
A “personal” account, which you probably created later on by the user.
Personal account can be renamed which means using a different email address to sign in to it. To fix it follow this KB article (https://support.microsoft.com/en-us/help/11545/microsoft-account-rename-your-personal-account)
If external user’s accepted the invite using the personal account and later on try to connect by selecting the work account and is getting the error “User not in directory”. This is the most common cause for the error. Make sure the user is using the same account to accept the invite and log-on to the site.
Secondly if the account used for accepting the invite and login are same and still the error screen pop’s up, then user account has to be set up again, but before we need to do the clean up on the existing references for user profile and remove the user from SharePoint and then send fresh invite. To remove the user and all references follow the below steps.
External users are managed from a site-collection–by–site-collection basis. An external user account must be removed from each site collection that the user was granted access to.
Browse to each site collection that the user previously had access to, and then follow below steps:
In the site collection, edit the URL in the browser by appending the following string to the site address:
- Select the user from the list and Click Delete. Then once user is removed next
- Start the SharePoint Online Management Shell.
- Type the following cmdlet:
$cred = Get-Credential
In the Windows PowerShell Credential required dialog box, type your site collection admin account and password, and then click OK.
- Connect to SharePoint Online, and then type the following cmdlet:
Connect-SPOService -Url https://tenant-admin.sharepoint.com -Credential $cred
- Remove the user from each site collection by using the following cmdlet:
$ExtUser = Get-SPOExternalUser -filter email@example.com
- Type the following cmdlet:
Remove-SPOExternalUser -UniqueIDs @($ExtUser.UniqueId)
Then we can add back the user and resend the invite. It should fix up the issue.
Last thing to check is that user has a proper role assigned to user account under user profile in the office portal.
- To check the role assigned to the user, Go to office 365 admin center.
- Sign in with global administrator’s account.
Check the external user in Users>Active users, then, check the roles of the external user and change it to User (no admin access).