Skip to main content
2 of 2
improve format, add new tag

How to query a list's user field for a given login name in Javascript?

I need to build a query a custom list with a user field. The where clause filters the results to a given list of user login names of a dynamic length, so I build the query according to the numbers of users.

My problem is that executeQueryAsync returns every item of the list, no matter how simple the where clause is.

Example for the simplest query:

<View><Query>
   <Where>
     <Eq>
       <FieldRef Name="UserName"/>
       <Value Type="User">domain\username</Value>
     </Eq>
   </Where>
</Query></View>

What could be wrong?

elsni
  • 471
  • 3
  • 8
  • 23