Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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: http://sharepoint.stackexchange.com/a/30858/2881

share|improve this answer
    
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

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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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