Domanda

I have got a custom SharePoint site setup, using JavaScript REST queries, and need to write a user into a "To" field of a custom list (setup as a Person field).

The site is at <domain>/sites/ncq/

If I search the UserInformationList local to the Site for a particular user:

<domain>/sites/ncq/_vit_bin/ListData.svc/UserInformationList?$filter=substringof('gosling', LastName)&$select=*

I get a user record with an ID number of 173.

If I search the UserInformationList at the root for the same user:

 <domain>/_vit_bin/ListData.svc/UserInformationList?$filter=substringof('gosling', LastName)&$select=*

I get the same user's record but the ID is 46095.

The user name, email address, contact details, SIPAddress, and Account are all identical, but I am not understanding why the ID is different between these two lists, I would have expected it to be the same.

Can anyone explain or help me understand why there's this difference ?

È stato utile?

Soluzione

That is because users get new IDs on each Site Collections.

A user might have ID 173 on one Site Collection but ID 46095 on another.

If you have sites located at the /sites managed path, then that is a new Site Collection and not a sub site, thus the user might have another ID.

To understand why there is changes in user ID you should know something detailed about User Information List:

User Information List:

As per the Name SharePoint User Information List stores information about a user by having some metadata set up for the user. Some examples are User Picture, Email, DisplayName, LoginName etc. This User Information list will be a hidden list and each site collection will have only one User Information list.

When we grant any user permissions to a user, they are added automatically to the hidden User Information list, a new item will be created in the User Information List storing some information about the user.

As we know there will be an ID associated with each item in a list, similarly there will be an ID associated with the item added in the User Information list. That id is called as Site User ID, only using this Site User ID we used to fetch the details of a user from the Site Collection or from User Information List of that site collection, to be more precise it is like fetching the item details from a list using the ID of the item.

So why does the Site User ID gets changed?

As said earlier, each site collection will have only one User Information list and the items added in the User Information list of Site Collection A will not be same as the User Information list of Site Collection B and so on. So there will be difference in ID of the list item and that is why you are getting different Site User ID for a same person entity in different site collections.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top