Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In a custom list definition, I'm building a view with this query :

      <Where>
          <Or>
            <Membership Type="CurrentUserGroups">
              <FieldRef Name="MyUserField" />
            </Membership>
            <Eq>
              <FieldRef Name="MyUserField" />
              <Value Type="Integer">
                <UserID Type="Integer" />
              </Value>
            </Eq>
          </Or>
      </Where>

As you guessed, the idea is to show only items if the field MyUserField contains the current user or a group where the user is a member.

Now I would like to change my query to restrict the display to users that are not designated (directly or via membership) in a second group.

I don't see any definition nor for a Not operation in Caml, neither for a NotMembership. This is not working :

<Where>
    <And>
        <Or>
            <Membership Type="CurrentUserGroups">
                <FieldRef Name="MyUserField" />
            </Membership>
            <Eq>
                <FieldRef Name="MyUserField" />
                <Value Type="Integer">
                    <UserID Type="Integer" />
                </Value>
            </Eq>
        </Or>
        <Not>
            <Or>
                <Membership Type="CurrentUserGroups">
                    <FieldRef Name="MyUserField2" />
                </Membership>
                <Eq>
                    <FieldRef Name="MyUserField2" />
                    <Value Type="Integer">
                        <UserID Type="Integer" />
                    </Value>
                </Eq>
            </Or>
        </Not>
    </And>
</Where>

Any suggestion?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.