I have a list. I need to filter the list view in SharePoint to show items:
- created by someone in current user's group
- show all to admin group
I am using Infopath for the list's form view, and have created 2 people/group picker fields.
1 people picker field, AssignedTo, has AccountID set to Admin and will be present in every form created.
The other, AssignedToish, is populated with GetGroupCollectionFromUser, and will store who created the form's group.
I tried a CAML query which worked, but would only filter the list to who created the items. The CAML is below:
<Query> <Where> <Membership Type="CurrentUserGroups"> <FieldRef Name="AssignedTo"/> </Membership> <Eq> <FieldRef Name="AssignedTo"/> <Value Type ="Integer"> <UserID Type="Integer"/> </Value> </Eq> <Or> <Membership Type="CurrentUserGroups"> <FieldRef Name="AssignedToish"/> </Membership> <Eq> <FieldRef Name="AssignedToish"/> <Value Type ="Integer"> <UserID Type="Integer"/> </Value> </Eq> </Or> </Where> </Query>
This will display correctly, as in, if I am logged in as a Assistant, I will only see forms created by Assistant group. The same goes for Supervisor group. The Supervisor group can view all/create for all members of all groups, but when a Supervisor creates one for Assistant group, the Assistant members cannot see it.
I assumed since my query actually filtered, it was correct, it just seems there is a [Me] somewhere in there when using the schema. OR the OR doesn't work?
To recap: With the above CAML, only users within the group that the item was created can see the item. I need to find a way to keep that for users that are NOT in Supervisors group.
Of all the tutorials I find online, from CAML filtering for one group, to jQuery filtering with a text box, they are all so close, just not quite right.