If you are want to get the userID you can simple use following code.
<Where>
<Eq>
<FieldRef Name='userfieldname' />
<Value Type='Integer'>
<UserID Type='Integer' />
</Value>
</Eq>
</Where>
in here you should declare the UserID variable before it uses. normally If you make a user filter in the SharePoint designer it will automatically create the parameter in parameter binding section in the web part.
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
But assume you want to filter using a user name and the field is not a persongroup feild and it is just a text field. then you can use following query to archive it.
<Where><Eq>
<FieldRef Name='userfieldname' />
<Value Type=’Text’>
<UserID Type=’Text’/>
</Value>
</Eq>
</Where>
Comments
I follow your sample code and modify my view query as the follow. The "Supervisor" and "Attn Monitor" are text fields that contain Windows login name (domain\username). My code does not work for me. Can you tell me what is wrong. Many thanks.
…
//
//
//…
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
what is your code. You are checking against the group or individual user id.
if you are searching like domain/username, change the display to "Account" in the people/group field.
I need to query listitems based on current logged in user account name, AD\joe.user in a content query webpart. The column I'm comparing against
is not a user field, it is a text column that contains a string like AD\joe.user. I need to be able to compare that string against the current logged in user.
This is what I have
Parameter Binding:
<property name="ParameterBindings" type="string">
<ParameterBinding Name="LogonUser" Location="ServerVariable(LOGON_USER)" DefaultValue="CurrentUserName"/>
</property>
CAML:
<Where>
<Eq>
<FieldRef Name='ReportAssignedTo' />
<Value Type='Text'>
<LogonUser Type='Text'/>
</Value>
</Eq>
</Where>
It return no results. Am I doing something wrong?
You can check whether the server variable has a value. If you are not sure about it you can put a list web part to a page with filter with current user view and check the page code in designer
<% LogonUser.Substring(4) %>
Hi you can get the result using caml and then manipulates either using string manipulation and xslt