May 28 2020 12:47 AM
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?
May 28 2020 05:27 AM
@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.
May 28 2020 07:04 AM
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>
May 28 2020 07:19 AM
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>
May 28 2020 08:25 AM
@rautchetan27 Try something like below:
1)<Where><Contains><FieldRef Name=\"Vendor\" /><Value Type='Text'>" + currentUser + "</Value></Contains></Where>
May 28 2020 10:27 PM
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
May 28 2020 11:17 PM - edited May 28 2020 11:18 PM
@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.
May 30 2020 02:44 AM
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
May 30 2020 03:34 AM
@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>
May 30 2020 07:49 AM
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
May 30 2020 09:51 AM - edited May 30 2020 09:55 AM
Solution@rautchetan27 : When you check person/groups column settings, you will find properties as per below screenshot
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.
May 31 2020 03:44 AM
Many thanks for the help! it resolved my issue and its working for me..thanks again!!!
May 31 2020 08:24 AM
@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.
Jun 01 2020 01:48 AM
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?
Jun 02 2020 02:20 AM
@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.
May 30 2020 09:51 AM - edited May 30 2020 09:55 AM
Solution@rautchetan27 : When you check person/groups column settings, you will find properties as per below screenshot
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.