Filter on current user with CAML Query.


Hi everybody,

Today I will give you a little trick with CAML Query: how to retrieve the current user.

Logic suggests that we write a query like this:

 <Eq> <FieldRef Name='AssignedTo' /> <value Type='User'> [Me]</ Value> </ Eq>  

But then, it does not work …
The proper way to retrieve the current user is to change our query like this.

 <Eq><FieldRef Name='AssignedTo' /><Value Type='Integer'><UserID Type='Integer'/></Value></Eq> 


And that way we get the current user.

Christopher.

4 thoughts on “Filter on current user with CAML Query.

Leave a comment