-->

Get User URL using CAML Query

2019-09-06 07:42发布

问题:

I am making use of CAML Query to filter the records from list into DataTable. I have a SPUser Field in my list.

I am endeavoring to obtain the user id of each user in CAML Query. Any insights on how to achieve this?

回答1:

Get items for an SPUser.ID:

<Where><Eq><FieldRef Name='Person' LookupId='TRUE'/><Value Type='Integer'>45</Value></Eq></Where>

Get items for the current user:

<Where><Eq><FieldRef Name='Person' LookupId='TRUE'/><Value Type='Integer'><UserID/></Value></Eq></Where>

Get items for a user's display name (what is displayed normally in the list):

<Where><Eq><FieldRef Name='Person'/><Value Type='Text'>Lastname, Raghu</Value></Eq></Where>