6

I'm trying to set up a calendar on SharePoint. A calendar item has a people picker to hold who the item is for. I have created groups for each project and have added people to the relevant group. I am trying to create views for each of these groups which will show only items where the person is part of that group.

On the view filter, I don't really want to add a 'Where person = 'first person' or person = 'second person' etc as if people come and go this could get too much to do so ideally the filter needs to be created dynamically from the group.

I have thought of two possible ways:

  1. On the View aspx, is there a way to dynamically create the element using JQuery? I could get the group name from this element and then get the list of users from the group and build up the string. From what I can see though by the time JQuery kicks in it would be using the generated aspx file, not the original file and so that element will not be there.

  2. Do something similar to https://stackoverflow.com/questions/325007/get-users-by-group-in-sharepoint or https://stackoverflow.com/questions/1399629/how-to-filter-list-items-by-user-group-column-in-sharepoint?. But I'm not too sure how to use this? I'm quite new to SharePoint development (I've been doing c# awhile though) but it looks like it is doing what I need to.

Thanks for your help

7
  • I don't know if I correctly understand what you want to do, but have you tried this? Commented Dec 14, 2012 at 9:35
  • That's not what I want unfortunately. The filter I want has nothing to do with who is currently looking. It should show all items assigned to people within a specified group
    – ADringer
    Commented Dec 14, 2012 at 9:38
  • Why don't you just filter by groupname then? I'm pretty sure this is possible. Commented Dec 14, 2012 at 10:28
  • The group name is not on the item, only the person. The person could be in multiple groups (and each group would require it's own view) so it's not feasible to add a group column to the item
    – ADringer
    Commented Dec 14, 2012 at 10:43
  • Oh okay... well. If I got it correctly now ;-) then I'd suggest to make a new column which holds groups and allows multiple selections. Then you could add the groups by hand, or just with a simple workflow which reads the groups of the current user and writes them to the column.I'm sure there are better ways but this would be easy. Commented Dec 14, 2012 at 11:11

2 Answers 2

1

You will need SharePoint Designer to achieve this.
Open your site on SharePoint Designer, select the list that you want to have the filter.
On the right hand side there will be several views, you will need to edit those to filter the user in group.
Edit the file, search for the tag inside the code.
The key ingredient is using the following CAML statement:

<Membership Type="CurrentUserGroups">
    <FieldRef Name="Person"/>
</Membership>

You can view a detailed post on how to achieve this here: https://anhvnn.wordpress.com/2017/08/18/sharepoint-online-filter-items-created-by-user-or-group-of-user-in-custom-list/

0

In SharePoint you cannot group/Search on some columns which are save as multi columns. Please find this additional information in this Post :

SharePoint Columns Cannot Group by or Filter a View with multiple value

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.