Freigeben über


SharePoint: Troubleshooting “User cannot be found” and other mysterious user behavior

Some potential symptoms:

  • You try to add a user to a SharePoint group. The account is added without error, but it doesn’t show up in the group.
  • You try to add a user to a "person or group" column in a list. The account is added successfully, but it doesn’t show up in the list.
  • You browse to the User Information List for the site collection (_layouts/15/people.aspx?MembershipGroupId=0), but the user does not show up there.
  • You try to create a SharePoint group. You get a "User cannot be found" error.
  • You try to add a user as a site collection administrator. You get a generic “Unexpected Error” in the UI. ULS logs show this:
    System.ArgumentException: User cannot be found.
    at Microsoft.SharePoint.SPList.GetItemById(String strId, Int32 id, String strRootFolder, Boolean cacheRowsetAndId, String strViewFields, Boolean bDatesInUtc)
    at Microsoft.SharePoint.SPContext.get_Item()
  • A user tries to sign up for an alert. You get a generic “Unexpected Error” in the UI. ULS logs show "User cannot be found".
  • You try to browse to the user display page in a site collection. For example: _layouts/15/userdisp.aspx?Force=True&ID=4030 (where “4030” is the user id). You get a generic “Unexpected Error” in the UI. ULS logs show "User cannot be found".

 

Note: The above behaviors can occur for all users within the site, or just for specific users.

 

Why does this happen?

All these behaviors can occur if there’s something wrong with the users record within the User Information List for the site collection.
Try these same things in other site collections, they probably work just fine.

 

So what to do?

First, try deleting the user from the site collection:

 $web = "https://teams.contoso.com/sites/t1"
$user = Get-SPUser -web $web | where {$_.UserLogin -like "*domain\UserName*"}
Remove-SPUser $user -web $web

 

Then try to add the user as a Site Collection Administrator (Site Settings | Site collection Administrators).

Note: This is a temporary troubleshooting step. Adding to site collection administrators takes a different code path and can bypass some of the problems you can run into when adding users to other SharePoint groups.

If the user is successfully added to Site Collection Administrators, then their user record should be fixed up. You can then remove the user from site collection admins and add them to the intended SharePoint groups / site permissions.

Ok, that didn’t work. Now what?

Another thing you could do is export, and then import the entire site collection.   This basically pulls out all data from the site into some files and then puts it back.  It's not a full fidelity backup and restore.
See this: https://technet.microsoft.com/en-us/library/ee428301.aspx 

If you’re unable or unwilling to do the export / import, unfortunately, you’re probably in a state where the only fix is via direct database update, which is not supported without the proper diagnosis and approvals from the SharePoint Product Group. If you open a support case with Microsoft, we can help get you fixed up in a supported manner.

 

How can I verify the User Information List is broken?

 

Run this PowerShell. It will output the ID for the User Information List.

 

 $site = get-spsite https://theProblemSite
$web = get-spweb $site.rootweb.url
$list = $web.lists['User Information List']
$list.id

Now take that ID and use it in this SQL query against the content database:

 

 SELECT * FROM AllUserData (nolock) WHERE tp_ListId = 'the User Info List ID' and tp_UIVersionString > 1.0 order by tp_id

 

If that query returns rows for your problem users (or really any rows at all), it means that versioning or moderation was enabled on your User Information List and now you have multiple versions of your user objects (not good).  Unlike other types of list items, SharePoint does not expect more than one version of a user object.   This is a complex problem involving multiple SQL tables. You can try the export / import, but you’ll probably need Microsoft support to fix up your SQL tables.  Trust me, this is not a situation for a DIY fix.  Again, it's unsupported to do so.