CAML query to filter List items on the basis of Current User group in sharepoint


I have List library which having column Name-Vendor, also I have differ sharepoint user groups for each vendor.

I am using CAML query to filter List items, so user can see list items belong to its vendor group only.

I am filtering List items using CAML query  where value of currentuser group will be same as Value in Column of list items-Vendor

I am using following CAML query, is this correct, I am not getting expected filter result.


<Where><Eq><FieldRef Name="User_ID"/><Value Type="Text">911</Value></Eq><Membership Type="CurrentUserGroups"><FieldRef Name='Vendor' /></Membership></Where>

2 Replies
best response confirmed by rautchetan27 (Contributor)

Hi @rautchetan27 

Try to use the below code

  <Membership Type=\"CurrentUserGroups\">
    <FieldRef Name=\"AssignedTo\"/>
    <FieldRef Name=\"AssignedTo\"></FieldRef>
    <Value Type=\"Integer\">

@Sudharsan K 

Thanks, its working now after makings some changes in column type