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>
4 comments:
Hi, Melick
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.
…
I do not while it not allow me post my code in the comment. One more try. If it still does not work, can I email my code to you and would please provide your email address. Thanks again.
//
//
//…
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
hi,
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.
Post a Comment