1

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?

I gave up on CAML, and starting researching doing this with Javascript or jQuery. I can get the current users groups to display, but not sure how to use this info in a filter with Javascript/jQuery, as I know even less about Javascript/jQuery.

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.

Any help with a CAML for 2 filters, or Javascript/jQuery would be absolutely great.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.