1

I am working with retrieving user info programmatically in WSS 3.0. I understand that users are stored in each Site Collection's User Information List. Deleted users are not visible in the User Information List on the people.aspx page. However, if you delete a user and add them again, they will take on the same ID as they had before. Where are these records stored?

1

You can pull deleted users from the SiteUserInfoList like this:

SPList myList = SPContext.Current.Web.SiteUserInfoList;

SPQuery query = new SPQuery { Query = "<Where><Eq><FieldRef Name='Deleted' /><Value Type='Boolean'>1</Value></Eq></Where>"};
SPListItemCollection entries = myList.GetItems(query);
if (entries == null || entries.Count == 0)
    throw new Exception("Users Not Found!");

You can query several other user properties as well. Details can be found at another of my answers here: https://sharepoint.stackexchange.com/a/30858/2881

  • Yes, my query works ONLY when I include the "<FieldRef Name='Deleted' />" tag. A query for any other field(s) will not include deleted users. Next question: Is there a way to (a) restore or (b) delete for good any of these "deleted" users? The Delete() function throws an error, and changing the "Deleted" field does not throw an error, but has no effect. – CigarDoug Mar 6 '12 at 18:36
  • Posted the really, truly, actually deleting a deleted user question as a new question: bit.ly/zRupvJ – CigarDoug Mar 7 '12 at 14:21
1

In the SharePoint Content Database, under the Table "UserInfo". It is not supported to write the database directly.

  • Short of querying the Content Database directly, is there a way to access "UserInfo" from, say, the SharePoint Object Model? – CigarDoug Mar 5 '12 at 18:26
  • Yes, see. – Trevor Seward Mar 5 '12 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.