Please upgrade your web browser now. Internet Explorer 6 is no longer supported.
Zac Smith
SharePoint, WSS and MOSS development.

User cannot be found error

by Zac Smith 12-Jul-07, 1 Comment
When clicking on the Site Collection Administrators link in Central Admin the following error screen displays:
 
This annoying error can occur during wss migrations, basically it means the primary or secondary site collection administrator refers to a user that does not exist.
Unfortunately it is not possible to get into the screen where you would make the change. The STSADM command siteowner returns the same error.
 
The only solution that I have found is to make a small edit to the database. To do this open up the content database that corresponds to the site collection and look at the Sites table. Find the row for the site that is throwing the error and update the ownerID or SecondaryContactID (See disclaimer below).
 
Now if you have a number of sites then you will need to work out which site is causing the problem - and the guids arent terribly descriptive.
 
So how do we work out which one? PowerShell to the rescue!!
If you haven't discovered the awesomness of PowerShell you should go away and do that right now. Otherwise you can keep reading :)
 
The first command I will run loads the SharePoint dll (I actually have this setup in my profile).
 
[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
 
Then I will create and SPSite object that will contain a reference to the site collection that is causing the error.
 
$spsite = New-Object Microsoft.SharePoint.SPSite("http://wsssite")
 
Now I can run commands on this object to discover various pieces of info. I could have created a little visual studio console app but that would just be annoying, plus interactively inspecting .Net objects is pretty damn cool.
 
So to get the site ID:
$spsite.ID.ToString()
 
And to get the details of the primary/secondary site coll admin details:
$spsite.RootWeb.SiteAdministrators
 
if you want a list of all available users you can try:
$spsite.RootWeb.AllUsers | ft Name, ID -auto
 
Now once you have worked out which user is causing problems (it could be both). Just update the IDs with valid user IDs and try navigating to the site collection administrators screen.
 
Disclaimer:
Editing the database in SharePoint is completely unsupported by Microsoft. If you do decide to make changes, I'd highly recommend making a backup first.
Categories:
1 response so far:

 

Post a Comment:
Name:
URL:
Email:
Comments: