March 2009
M T W T F S S
« Feb   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Archive for March, 2009

23
Mar

User cannot be found

User cannot be found.   at Microsoft.SharePoint.SPUserCollection.GetByID(Int32 id)
   at Microsoft.SharePoint.Publishing.CommonUtilities.LookUpUser(SPWeb web, String userLookupValue)
   at Microsoft.SharePoint.Publishing.CommonUtilities.GetUserFieldValue(SPListItem item, Guid fieldId)
   at Microsoft.SharePoint.Publishing.PublishingPage.get_Contact()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.LoadValues()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.OnLoad(EventArgs e)
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

An odd thing can happened in SharePoint. If you add a user named Joe Smith to a server, then add that user to SharePoint. Later you need to completely remove that user. So you delete the user from the server and you completely remove the user from sharepoint. (removed them from the user collection, not just the site)

One day comes and low and behold you need to add Joe Smith to the server again. You create a new user account for Joe on the server and add Joe to SharePoint. The only issue is that SharePoint doesnt resurrect the user from SharePoint. It creates a new one. And now when you are in a page that was originally created by the 1st Joe Smith you get the error above. Yippy.

If you run the SQL below you will find the two Joe Smith accounts.

SELECT * FROM UserInfo WHERE tp_Login = ‘MYSERVER\Joe.Smith’

You will get results like this

 

No User SQL

No User SQL

 The field tp_ID is the SharePoint UserID. The field sp_Deleted tells SharePoint if the user has been deleted. When you manually flag a user as deleted, all you have to do is to put the user’s ID in the tp_Deleted field. Notice that the user 19 has 19 in the tp_Deleted field.

So to resurrect the user 19 I need to kill user 16 since they both have the same username. The way I do that is simple

UPDATE UserInfo SET tp_Deleted = 16 WHERE tp_ID = ‘16′
UPDATE UserInfo SET tp_Deleted = 0 WHERE tp_ID = ‘19′
 

The SQL above will set user 16 to deleted by adding 16 to their tp_Deleted field. Changing user 19’s tp_Deleted field to 19 makes them active and all pages will work when you try and view page properties.

 

 

 

 

I hope this help anyone who runs into the same issue. I was a pain to try and diagnose why it wouldnt work and I think there is a fix for it coming from MS. But this server is on SP1 and it still does it.
NOTE: This sinerio will work if you just delete a user from SharePoint completely and need to edit their pages. Just put a "0" in the tp_deleted.