SOLVED

filtering list items using CAML query for currentuser group

%3CLINGO-SUB%20id%3D%22lingo-sub-1421913%22%20slang%3D%22en-US%22%3Efiltering%20list%20items%20using%20CAML%20query%20for%20currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1421913%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20using%20CAML%20query%20to%20filter%20list%20items%20on%20the%20basis%20of%20user%20group.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CMEMBERSHIP%20type%3D%22%5C%26quot%3BCurrentUserGroups%5C%26quot%3B%22%3E%3CFIELDREF%20name%3D%22%5C%26quot%3BVendor%5C%26quot%3B%2F%22%3E%3C%2FFIELDREF%3E%3C%2FMEMBERSHIP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ebut%20above%20query%20not%20working%2C%20do%20i%20need%20to%20put%20%5C%20in%20above%20query%3F%3C%2FP%3E%3CP%3Eif%20I%20put%20%5C%20before%20Vendor%20%2C%20it%20throwing%20error%20%2C%20but%20no%20error%20for%20%5C%20before%20currentusergroups%3C%2FP%3E%3CP%3Ewhat%20is%20purpose%20of%20this%20%5C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20whats%20wrong%20with%20my%20query%3F%20i%20have%20created%20sharepoint%20group%20and%20the%20granted%20full%20access%20to%20given%20list%20for%20group%20%2C%20then%20trying%20to%20filter%20list%20items%20on%20the%20basis%20of%20CAML%20query%20and%20current%20user%20group%20so%20only%20list%20items%20having%20value%20in%20Vendor%20column%20equal%20to%20current%20users%20sharepoint%20group%20can%20visible%20to%20that%20user%3Fcan%20anyone%20help%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1421913%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ecaml%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELists%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1429261%22%20slang%3D%22en-US%22%3ERe%3A%20filtering%20list%20items%20using%20CAML%20query%20for%20currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1429261%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F670519%22%20target%3D%22_blank%22%3E%40rautchetan27%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20to%20use%20the%20below%20code%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3COR%3E%0A%20%20%3CMEMBERSHIP%20type%3D%22%5C%26quot%3BCurrentUserGroups%5C%26quot%3B%22%3E%0A%20%20%20%20%3CFIELDREF%20name%3D%22%5C%26quot%3BAssignedTo%5C%26quot%3B%2F%22%3E%0A%20%20%3C%2FFIELDREF%3E%0A%20%20%3CEQ%3E%0A%20%20%20%20%3CFIELDREF%20name%3D%22%5C%26quot%3BAssignedTo%5C%26quot%3B%22%3E%3C%2FFIELDREF%3E%0A%20%20%20%20%3CVALUE%20type%3D%22%5C%26quot%3BInteger%5C%26quot%3B%22%3E%0A%20%20%20%20%20%20%3CUSERID%3E%3C%2FUSERID%3E%0A%20%20%20%20%3C%2FVALUE%3E%0A%20%20%3C%2FEQ%3E%0A%3C%2FMEMBERSHIP%3E%3C%2FOR%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1429585%22%20slang%3D%22en-US%22%3ERe%3A%20filtering%20list%20items%20using%20CAML%20query%20for%20currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1429585%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F144422%22%20target%3D%22_blank%22%3E%40Sudharsan%20K%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%20its%20working%20now%20after%20makings%20some%20changes%20in%20column%20type%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

I am using CAML query to filter list items on the basis of user group.

 

<Membership Type=\"CurrentUserGroups\"><FieldRef Name=\"Vendor\"/></Membership>

 

but above query not working, do i need to put \ in above query?

if I put \ before Vendor , it throwing error , but no error for \ before currentusergroups

what is purpose of this \

 

and whats wrong with my query? i have created sharepoint group and the granted full access to given list for group , then trying to filter list items on the basis of CAML query and current user group so only list items having value in Vendor column equal to current users sharepoint group can visible to that user?can anyone help 

2 Replies
Highlighted
Best Response confirmed by rautchetan27 (Contributor)
Solution

Hi @rautchetan27 

Try to use the below code

<Or>
  <Membership Type=\"CurrentUserGroups\">
    <FieldRef Name=\"AssignedTo\"/>
  </Membership>
  <Eq>
    <FieldRef Name=\"AssignedTo\"></FieldRef>
    <Value Type=\"Integer\">
      <UserID/>
    </Value>
  </Eq>
</Or>
Highlighted

@Sudharsan K 

 

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