SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to hard code a user group into a CAML query's where clause. The reason is so that I can apply additional criteria when the user is in one group, and something else if they are in another group. I don't want to check the "Assigned To" field for a value, I just want to hard code a user group in it. How do I do that? Thank you. Here is the CAML :

                    <Membership Type="CurrentUserGroups">
                      <FieldRef Name="AssignedTo"/>
                <GroupBy Collapse="FALSE">
                    <FieldRef Name="AssignedTo"/>
                    <FieldRef Name="AssignedTo"/>
                    <FieldRef Name="Status"/>
                    <FieldRef Name="Priority"/>
share|improve this question
up vote 1 down vote accepted

Another solution is to add another people or group field in the list and populate it with a workflow. Then, use that field in between the membership type elements instead of "AssignedTo".

share|improve this answer

This is a long shot but try just entering the name of the group in between the Membership tags. You may need to format it with the group ID, then ;# and finally the group name.

share|improve this answer
Thank you Alex. I tried 14;#Division_x0020_Managers in between the membership tags but wasn't successful. – Anonymous Jul 5 '10 at 17:10

Unfortunately you can't combine Membership element with Value element. See syntax (childs element) documentation of Membership element.

<Membership Type="CurrentUserGroups">
  <Value>NOT POSSIBLE</Value>

If you use SP Server you can use feature: Audience targeting settings

  1. Create more Views, where every view is for specific group.
  2. Show each view to diferent group: Add all views to Page (use add WebPart) and set webpart property in advance tab Target Audiences(in c#: AuthorizationFilter). To this property you can add specific group name. WebPart is shown only to this group.

In SP Foundation you can't use this. But you can implement your own WebPart RuntimeFilter. More info about RuntimeFilter is in book SharePoint 2010 Web Parts in Action (page 140-147)

share|improve this answer

Your Answer


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