CAML query is used to retrieve data from SharePoint lists. To perform a filter based on Person or User Group or a specific user id follow any of the below approach
All the below queries are based on a SharePoint List Column named as “User ID” of type Person or Group
Option 1 – If you know the display name of the user
<Where>
<Eq>
<FieldRef Name='User_x0020_ID' />
<Value Type='User'>System Account</Value>
</Eq>
</Where>
Option 2 – If you know the User Id ( not the login id)
<Where>
<Eq>
<FieldRef Name='User_x0020_ID' LookupId='True' />
<Value Type='User'>1073741823</Value>
</Eq>
</Where>
Option 3 – If you would like to filter based on current user (logged in User )
<Where>
<Eq>
<FieldRef Name='User_x0020_ID'/>
<Value Type='User'><UserID/></Value>
</Eq>
</Where>
Leave a comment