SOLVED

CAML query to filter sharepoint list on the basis of Currentuser group

%3CLINGO-SUB%20id%3D%22lingo-sub-1422993%22%20slang%3D%22en-US%22%3ECAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1422993%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20using%20following%20query%20to%20filter%20List%20items%20on%20the%20basis%20of%20current%20user%20group%2C%20so%20current%20user%20only%20can%20see%20list%20items%20which%20having%20value%20in%20column%20Vendor%20same%20as%20name%20of%20currentuser%20group.%3C%2FP%3E%3CP%3EI%20have%20%3CAND%3E%20condition%20in%20query%20which%20working%20correctly%2C%20but%20Condition%20for%20Currentusergroup%20is%20not%20working%20and%20its%20not%20filtering%20with%20value%20of%20currentusergroup%3C%2FAND%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CWHERE%3E%3CAND%3E%3CEQ%3E%3CFIELDREF%20name%3D%22%26quot%3BADM_x0020_ID%26quot%3B%2F%22%3E%3CVALUE%20type%3D%22%26quot%3BText%26quot%3B%22%3E1234%3C%2FVALUE%3E%3C%2FFIELDREF%3E%3CEQ%3E%3CFIELDREF%20name%3D%22%26quot%3BVendor_new%26quot%3B%2F%22%3E%3CVALUE%20type%3D%22%26quot%3BText%26quot%3B%22%3EIBM%3C%2FVALUE%3E%3C%2FFIELDREF%3E%3C%2FEQ%3E%3CEQ%3E%3CMEMBERSHIP%20type%3D%22%26quot%3BCurrentUserGroups%26quot%3B%22%3E%3CFIELDREF%20name%3D%22%26quot%3BVendor%26quot%3B%2F%22%3E%3C%2FFIELDREF%3E%3C%2FMEMBERSHIP%3E%3C%2FEQ%3E%3C%2FEQ%3E%3C%2FAND%3E%3C%2FWHERE%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eanyone%20can%20tell%20whats%20wrong%20in%20above%20query%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1422993%22%20slang%3D%22en-US%22%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-1423582%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1423582%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%20I%20think%20you%20are%20not%20comparing%20Vendor%20value%20with%20the%20user%2C%20kindly%20check%20below%20query.%20Hope%20it%20will%20help.%20Try%20to%20use%20user%20ID%20instead%20of%20username%20query%20as%20below%3A%3C%2FP%3E%3CP%3E%3CEQ%3E%3CBR%20%2F%3E%3CMEMBERSHIP%20type%3D%22%5C%26quot%3BCurrentUserGroups%5C%26quot%3B%22%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CFIELDREF%20name%3D%22%5C%26quot%3BVendor%5C%26quot%3B%2F%22%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3C%2FFIELDREF%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3CEQ%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3CFIELDREF%20name%3D%22%5C%26quot%3BVendor%5C%26quot%3B%22%3E%3C%2FFIELDREF%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3CVALUE%20type%3D%22%5C%26quot%3BInteger%5C%26quot%3B%22%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3CUSERID%3E%3C%2FUSERID%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3C%2FVALUE%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3C%2FEQ%3E%3CBR%20%2F%3E%3C%2FMEMBERSHIP%3E%3C%2FEQ%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20I%20have%20answered%20your%20question%2C%20please%20mark%20your%20post%20as%20Solved.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EIf%20you%20like%20my%20response%2C%20please%20give%20it%20a%20Thumbs%20Up.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1423834%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1423834%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20dont%20want%20to%20use%20UseId%2C%20i%20am%20trying%20following%20query%2C%20but%20no%20Luck..any%20idea%20whats%20going%20wrong%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CQUERY%3E%3CBR%20%2F%3E%3CWHERE%3E%3CBR%20%2F%3E%3CEQ%3E%3CBR%20%2F%3E%3CMEMBERSHIP%20type%3D%22%26quot%3BCurrentUserGroups%26quot%3B%22%3E%3CBR%20%2F%3E%3CFIELDREF%20name%3D%22%26quot%3BVendor%26quot%3B%2F%22%3E%3CBR%20%2F%3E%3C%2FFIELDREF%3E%3CBR%20%2F%3E%3C%2FMEMBERSHIP%3E%3CBR%20%2F%3E%3C%2FEQ%3E%26gt%3B%3CBR%20%2F%3E%3C%2FWHERE%3E%3C%2FQUERY%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1423860%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1423860%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20tried%20following%20query%20also%2C%20but%20it%20throw%20error%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CQUERY%3E%3CWHERE%3E%3CEQ%3E%3CFIELDREF%20name%3D%22%26quot%3BVendor%26quot%3B%2F%22%3E%3CVALUE%20type%3D%22%26quot%3BText%26quot%3B%22%3E%3CMEMBERSHIP%20type%3D%22%26quot%3BCurrentUserGroups%26quot%3B%22%3E%3C%2FMEMBERSHIP%3E%3C%2FVALUE%3E%3C%2FFIELDREF%3E%3C%2FEQ%3E%3C%2FWHERE%3E%3C%2FQUERY%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1424094%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1424094%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3BTry%20something%20like%20below%3A%3C%2FP%3E%3CP%3E1)%3CSPAN%20class%3D%22str%22%3E%3CWHERE%3E%3CCONTAINS%3E%3CFIELDREF%20name%3D%22%5C%26quot%3BVendor%5C%26quot%3B%22%3E%3C%2FFIELDREF%3E%3CVALUE%20type%3D%22'Text'%22%3E%22%3C%2FVALUE%3E%3C%2FCONTAINS%3E%3C%2FWHERE%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pln%22%3EcurrentUser%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22str%22%3E%22%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%3CDIV%20class%3D%22grid%20mb0%20fw-wrap%20ai-start%20jc-end%20gs8%20gsy%22%3E%3CDIV%20class%3D%22grid--cell%20mr16%22%3E%3CSTRONG%3ENote%3A%26nbsp%3B%3C%2FSTRONG%3EWhen%20you%20use%20text%20%3CCONTAINS%3E%20tag%20will%20give%20you%20the%20results%20all%20that%20is%20matching.%3C%2FCONTAINS%3E%3C%2FDIV%3E%3CDIV%20class%3D%22grid--cell%20mr16%22%3E2)%26nbsp%3B%3CWHERE%3E%3CEQ%3E%3CFIELDREF%20name%3D%22%5C%26quot%3BVendor%5C%26quot%3B%22%3E%3C%2FFIELDREF%3E%3CVALUE%20type%3D%22'User'%22%3E%22%20%2B%20currentUser%20%2B%20%22%3C%2FVALUE%3E%3C%2FEQ%3E%3C%2FWHERE%3E%3C%2FDIV%3E%3CDIV%20class%3D%22grid--cell%20mr16%22%3E3)%26nbsp%3B%3CWHERE%3E%3CEQ%3E%3CFIELDREF%20name%3D%22'Vendor'%22%20lookupid%3D%22'True'%2F%22%3E%3CVALUE%20type%3D%22'Lookup'%22%3E%22%20%2B%20_spPageContextInfo.userId%20%2B%20%22%3C%2FVALUE%3E%3C%2FFIELDREF%3E%3C%2FEQ%3E%3C%2FWHERE%3E%3C%2FDIV%3E%3CDIV%20class%3D%22grid--cell%20mr16%22%3E%3CSTRONG%3ENote%3A%26nbsp%3B%3C%2FSTRONG%3Ewith%20User%20ID%20-%20it%20will%20give%20you%20the%20exact%20match%20and%20will%20return%20only%20one%20value.%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22grid--cell%20mr16%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22grid--cell%20mr16%22%3EHope%20it%20helps%20!%3C%2FDIV%3E%3C%2FDIV%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1425671%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425671%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHI%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20dont%20want%20to%20use%20user%2C%26nbsp%3B%20in%20vendor%20column%20I%20will%20have%20sharepoint%20group%20names%3C%2FP%3E%3CP%3EIT%3C%2FP%3E%3CP%3EInfra%3C%2FP%3E%3CP%3EFinance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20three%20sharepoint%20groups%20with%20same%20Name%20and%20users%20are%20added%20to%20one%20of%20the%20sharepoint%20groups%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eso%20when%20user%20access%20list%2C%20it%20will%20able%20to%20see%20only%20list%20items%20having%20value%20on%20column%20same%20as%20user%20group%20name%20thats%20why%20i%20want%20to%20use%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CWHERE%3E%3CMEMBERSHIP%20type%3D%22%26quot%3BCurrentUserGroups%26quot%3B%22%3E%3CFIELDREF%20name%3D%22%26quot%3BVendor%26quot%3B%2F%22%3E%3C%2FFIELDREF%3E%3C%2FMEMBERSHIP%3E%3C%2FWHERE%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20internet%20i%20found%20same%20solution%20many%20places%20but%20somehow%20its%20not%20working%20for%20me%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1425714%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1425714%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%26nbsp%3B%20Ohk%20got%20you%20!%20Yours%20query%20looks%20correct%20in%20that%20case.%3C%2FP%3E%3CP%3E1)%26nbsp%3BFirst%20check%20whether%20you%20have%20access%20to%20check%20others%20task%20or%20not%20.%3C%2FP%3E%3CP%3E2)%20Second%2C%20if%20you%20are%20doing%20this%20programmatically%20then%20you%20can%20check%20you%20query%20via%20CAML%20Query%20Builder.%3C%2FP%3E%3CP%3E3)%26nbsp%3BYou%20can%20use%20CSOM%20to%20display%20the%20specific%20items%20as%20you%20want.%20Use%20SPWeb.CurrentUser.Groups%20to%20get%20the%20collection%20of%20groups%20of%20which%20the%20user%20is%20a%20member.%20And%20use%20CAML%20query%20to%20filter%20on%20items%20which%20were%20assigned%20to%20current%20user%20and%20current%20user%E2%80%99s%20groups.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1428424%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1428424%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20getting%20error%20where%20using%20Membership%20tag%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CQUERY%3E%3CWHERE%3E%3CMEMBERSHIP%20type%3D%22%26quot%3BCurrentUserGroups%26quot%3B%22%3E%3CFIELDREF%20name%3D%22%26quot%3BVendor%26quot%3B%22%3E%3C%2FFIELDREF%3E%3C%2FMEMBERSHIP%3E%3C%2FWHERE%3E%3C%2FQUERY%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eerror%20Correlation%20ID%3A%20076f579f-20f1-b000-c31a-67e814dcf994%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20sure%20whats%20wrong%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1428452%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1428452%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%20Hope%20%22Vendor%22%20column%20is%20a%20person%2Fgroups%20type%20column.%20I%20tried%20below%20query%20and%20it%20worked%20for%20me%3A%3C%2FP%3E%3CP%3E%3CWHERE%3E%3CBR%20%2F%3E%3CMEMBERSHIP%20type%3D%22'CurrentUserGroups'%22%3E%3CBR%20%2F%3E%3CFIELDREF%20name%3D%22'AssignedTo'%2F%22%3E%3CBR%20%2F%3E%3C%2FFIELDREF%3E%3CBR%20%2F%3E%3C%2FMEMBERSHIP%3E%3C%2FWHERE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1428663%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1428663%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20reply%2C%20I%20changed%20column%20to%20Person%2FGroups%20and%20now%20I%20am%20not%20getting%20error%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ebut%20in%20that%20person%2Fgroup%20column%20when%20I%20try%20to%20edit%2C%20its%20not%20Populating%20sharepoint%20groups...is%20that%20active%20directory%20group%20that%20we%20need%20to%20populate%20in%20Person%2Fgroup%20column%3F%3C%2FP%3E%3CP%3Eis%20it%20possible%20to%20assigned%20sharepoint%20group%3F%3C%2FP%3E%3CP%3EPlease%20help%2C%20I%20am%20new%20to%20sharepoint%20and%20struggeling%20this%20requirement%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1428777%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1428777%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%20When%20you%20check%20person%2Fgroups%20column%20settings%2C%20you%20will%20find%20properties%20as%20per%20below%20screenshot%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22PersonGroupCol.PNG%22%20style%3D%22width%3A%20448px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F195523i84769314A508BBFE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22PersonGroupCol.PNG%22%20alt%3D%22PersonGroupCol.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EAllow%20selection%20%3A%20People%20and%20Groups%20should%20be%20selected%3C%2FP%3E%3CP%3EChoose%20from%20All%20users%20if%20you%20want%20to%20allow%20both%20people%20and%20groups%20or%20SharePoint%20Groups%20only%20to%20show%20SP%20groups.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20it%20helps%20!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20have%20answered%20your%20question%2C%20please%20mark%20your%20post%20as%20solved.%3C%2FP%3E%3CP%3Eif%20you%20like%20my%20response%2C%20please%20give%20it%20a%20thumbs%20up.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1429592%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1429592%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%20for%20the%20help!%20it%20resolved%20my%20issue%20and%20its%20working%20for%20me..thanks%20again!!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1429863%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1429863%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%20Glad%20to%20hear%20that%20I%20am%20able%20to%20resolve%20your%20query.%20Thanks%20!%3C%2FP%3E%3CP%3EIf%20I%20have%20answered%20your%20question%2C%20please%20mark%20your%20post%20as%20solved.%3C%2FP%3E%3CP%3Eif%20you%20like%20my%20response%2C%20please%20give%20it%20a%20thumbs%20up.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1430546%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1430546%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F679665%22%20target%3D%22_blank%22%3E%40Ashish_Kohale%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20we%20define%20different%20permissions%20for%20members%20of%20same%20group%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20one%20group%20say%20%22IT%20infra%22%3C%2FP%3E%3CP%3Ein%20that%20group%20I%20have%204%20members%2C%20i%20want%203%20members%20can%20have%20Read%20permission%20and%20one%20member%20only%20can%20have%20read%2Fwrite%2Fedit%20permission%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eis%20this%20possible%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1432926%22%20slang%3D%22en-US%22%3ERe%3A%20CAML%20query%20to%20filter%20sharepoint%20list%20on%20the%20basis%20of%20Currentuser%20group%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1432926%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%20Group%20permission%20is%20applied%20to%20all%20the%20members%20of%20the%20group.%20Within%20group%20you%20cannot%20categorize%20the%20permission.%20This%20mentioned%20scenario%20you%20can%20handle%20through%20unique%20permission.%20But%20you%20have%20to%20include%20same%20members%20in%20different%20groups.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

I am using following query to filter List items on the basis of current user group, so current user only can see list items which having value in column Vendor same as name of currentuser group.

I have <And> condition in query which working correctly, but Condition for Currentusergroup is not working and its not filtering with value of currentusergroup

 

<Where><And><Eq><FieldRef Name="ADM_x0020_ID"/><Value Type="Text">1234</Value></Eq><Eq><FieldRef Name="Vendor_new"/><Value Type="Text">IBM</Value></Eq></And><Eq><Membership Type="CurrentUserGroups"><FieldRef Name="Vendor"/></Membership></Eq></Where>

 

anyone can tell whats wrong in above query?

14 Replies
Highlighted

@rautchetan27 : I think you are not comparing Vendor value with the user, kindly check below query. Hope it will help. Try to use user ID instead of username query as below:

<Eq>
<Membership Type=\"CurrentUserGroups\">
    <FieldRef Name=\"Vendor\"/>
  </Membership>
  <Eq>
  <FieldRef Name=\"Vendor\"></FieldRef>
  <Value Type=\"Integer\">
  <UserID/>
  </Value>
  </Eq>
</Eq>

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

 

Highlighted

@Ashish_Kohale 

 

I dont want to use UseId, i am trying following query, but no Luck..any idea whats going wrong?

 

<Query>
<Where>
<Eq>
<Membership Type="CurrentUserGroups">
<FieldRef Name="Vendor"/>
</Membership>
</Eq>
</Where>>
</Query>

Highlighted

@Ashish_Kohale 

 

i tried following query also, but it throw error

 

<Query><Where><Eq><FieldRef Name="Vendor"/><Value Type="Text"><Membership Type="CurrentUserGroups"></Membership></Value></Eq></Where></Query>

Highlighted

@rautchetan27 Try something like below:

1)<Where><Contains><FieldRef Name=\"Vendor\" /><Value Type='Text'>" + currentUser + "</Value></Contains></Where>

Note: When you use text <contains> tag will give you the results all that is matching.
2) <Where><Eq><FieldRef Name=\"Vendor\" /><Value Type='User'>" + currentUser + "</Value></Eq></Where>
3) <Where><Eq><FieldRef Name='Vendor' LookupId='True'/><Value Type='Lookup'>" + _spPageContextInfo.userId + "</Value></Eq></Where>
Note: with User ID - it will give you the exact match and will return only one value. 
 
Hope it helps !
Highlighted

@Ashish_Kohale 

 

HI,

 

I dont want to use user,  in vendor column I will have sharepoint group names

IT

Infra

Finance

 

I have three sharepoint groups with same Name and users are added to one of the sharepoint groups

 

so when user access list, it will able to see only list items having value on column same as user group name thats why i want to use

 

 

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

 

On internet i found same solution many places but somehow its not working for me

 

Highlighted

@rautchetan27 :  Ohk got you ! Yours query looks correct in that case.

1) First check whether you have access to check others task or not .

2) Second, if you are doing this programmatically then you can check you query via CAML Query Builder.

3) You can use CSOM to display the specific items as you want. Use SPWeb.CurrentUser.Groups to get the collection of groups of which the user is a member. And use CAML query to filter on items which were assigned to current user and current user’s groups.

Highlighted

@Ashish_Kohale 

 

I am getting error where using Membership tag

 

<Query><Where><Membership Type="CurrentUserGroups"><FieldRef Name="Vendor" /></Membership></Where></Query>

 

error Correlation ID: 076f579f-20f1-b000-c31a-67e814dcf994

 

Not sure whats wrong

Highlighted

@rautchetan27 : Hope "Vendor" column is a person/groups type column. I tried below query and it worked for me:

<Where>
<Membership Type='CurrentUserGroups'>
<FieldRef Name='AssignedTo'/>
</Membership>
</Where>

Highlighted

@Ashish_Kohale 

 

Thanks for reply, I changed column to Person/Groups and now I am not getting error

 

but in that person/group column when I try to edit, its not Populating sharepoint groups...is that active directory group that we need to populate in Person/group column?

is it possible to assigned sharepoint group?

Please help, I am new to sharepoint and struggeling this requirement

Highlighted
Solution

@rautchetan27 : When you check person/groups column settings, you will find properties as per below screenshot

PersonGroupCol.PNG

Allow selection : People and Groups should be selected

Choose from All users if you want to allow both people and groups or SharePoint Groups only to show SP groups.

 

Hope it helps !

 

If I have answered your question, please mark your post as solved.

if you like my response, please give it a thumbs up.

Highlighted

@Ashish_Kohale 

 

Many thanks for the help! it resolved my issue and its working for me..thanks again!!!

Highlighted

@rautchetan27 : Glad to hear that I am able to resolve your query. Thanks !

If I have answered your question, please mark your post as solved.

if you like my response, please give it a thumbs up.

Highlighted

@Ashish_Kohale 

 

Can we define different permissions for members of same group?

 

I have one group say "IT infra"

in that group I have 4 members, i want 3 members can have Read permission and one member only can have read/write/edit permission

 

is this possible?

Highlighted

@rautchetan27 : Group permission is applied to all the members of the group. Within group you cannot categorize the permission. This mentioned scenario you can handle through unique permission. But you have to include same members in different groups.