SharePoint Online: Delete User from User Information List
Problem: Deleted user accounts still appear in SharePoint Online People Picker! We need to remove the user from the user information list!
Root Cause: When a SharePoint Online user browses a site, SharePoint creates an entry in the “User Information List” to cache the user information. SharePoint syncs this list from the user profile when the user create/edit/update/delete items. When the user is deleted in Office 365 Azure AD, their related entry in the UserInfo list is not removed.
How to Delete User from User Information List in SharePoint Online?
To remove a user from the user information list, follow these steps:
- Navigate to the URL in the browser to: https://YourDomain.sharepoint.com/_layouts/15/people.aspx?membershipGroupId=0
- This takes you to the “All People” View. Now you can select and remove users from this User Information List by Clicking on Actions >> Delete User from Site Collection, and then confirm the prompt.
This deletes the user from the user information list in SharePoint Online. We can also remove users from the user information list in SharePoint Online using PowerShell.
SharePoint Online: PowerShell to Remove User from User Information List
Let’s use PowerShell to remove the user(s) from the user information list in SharePoint Online.
#Import SharePoint Online module
Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking
Function Delete-SPOUser()
{
param
(
[Parameter(Mandatory=$true)] [string] $AdminCenterURL,
[Parameter(Mandatory=$true)] [string] $SiteURL,
[Parameter(Mandatory=$true)] [string] $UserID
)
Try {
#Get Credentials to connect
$Cred = Get-Credential
#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential $Cred
#Remove user from user information list
Remove-SPOUser -Site $SiteURL -LoginName $UserID
Write-host -f Green "Removed the User '$UserID' from $SiteURL"
}
Catch {
write-host -f Red "Error Deleting Orphan Users!" $_.Exception.Message
}
}
#Set Variables
$AdminCenterURL="https://crescent-admin.sharepoint.com/"
$SiteURL="https://crescent.sharepoint.com/"
$UserID="chauhan.ajay_synechron.com#EXT#@crescent.onmicrosoft.com"
#Call the function to delete the user from user information list
Delete-SPOUser -AdminCenterURL $AdminCenterURL -SiteURL $SiteURL -UserID $UserID
Since the people picker caches search results, you may have to close your current browser sessions to clear the cache and cookies for the changes to reflect. Here is another post to get all orphan users in SharePoint Online and delete them: SharePoint Online: Find and Delete Orphaned Users using PowerShell
Seriously how is this even a thing. Shouldn’t Microsoft treat this as an incident and fix it in their backend?