SharePoint user info User Information List and People Column Type

3.7k views Asked by At

I am retrieving the user information from a number of site collections through the SharePoint web services.

http://mysitecollection.com/_vti_bin/usergroup.asmx

Using the 'GetAllUserCollectionFromWeb' method to return all the users for a site collection.

The XML below is an example of what is returned.

<Users>
    <User 
        ID="108" 
        Sid="S-1-5-21-1650336054-1974872081-316617838-5403" 
        Name="Ian Curtis" 
        LoginName="JOY\division" 
        Email="[email protected]" 
        Notes="" 
        IsSiteAdmin="False" 
        IsDomainGroup="False" />
</Users>

The question I have is this.

I'm getting a list item from the Lists web service and one of the fields is a Person column. The information is stored in the format of Id;#Name

In some instances the ID from this field does not exists in the users returned for that site collection, so where is the ID from? Is it from the User Profile store?

I have also noticed that the ID for a user returned from the UserGroup web service is different across different Site Collections for the same user (i.e. the same login).

If the user profile sync is running would these be the same?

1

There are 1 answers

2
djeeg On BEST ANSWER

In some instances the ID from this field does not exists in the users returned for that site collection, so where is the ID from? Is it from the User Profile store?

I have had this happen when a user is deleted from AD, or when you import content into a site or farm where that user does not exist anymore. I would guess that the person value is invalid. Remember that a person field is just a lookup field onto the user information list. To bring the user back (if they exist) use the EnsureUser method, but they will get a new id, so you will have to fix that up.

I have also noticed that the ID for a user returned from the UserGroup web service is different across different Site Collections for the same user (i.e. the same login). If the user profile sync is running would these be the same?

This is correct, the user id is different per site collection. It kind of annoying, but it makes sense, because other wise you would have to create all users in all site collections. I believe the user profile sync looks at the account name or sid to do the matching and updating.