Search by User field

Mar 17, 2015 at 2:52 PM
Hi,

I wonder how to write query in the library if I need to do search by User field
Mar 17, 2015 at 9:42 PM
Hi,

Search by user id:
var query = new CamlBuilder.Where().UserField("AssignedTo").Id().EqualTo(11);
Search for records assigned to current user:
var query = new CamlBuilder.Where().UserField("AssignedTo").EqualToCurrentUser();
Search by user display name (not very reliable, of course):
var query = new CamlBuilder.Where().UserField("AssignedTo").ValueAsText().EqualTo("John Brown");
And so on.

If you have only login name, you'll have to first resolve this user and get his ID.

And I would recommend to give CamlJs Console a try, so you don't waste your time asking, and rather just go and check yourself.
Screenshot from CamlJs Console:

Image