Based on feedback from my earlier questionearlier question, I have constructed a query using the excellent CAML Builder tool:
<Where>
<Or>
<Membership Type='CurrentUserGroups'>
<FieldRef Name='Users'/>
</Membership>
<Eq>
<FieldRef Name='Users'/>
<Value Type='Integer'>
<UserID/>
</Value>
</Eq>
</Or>
</Where>
This indeed returns a filtered list of rows.
However, trying to implement the same query in code fails to filter the list (all items are returned):
SPQuery query = new SPQuery();
query.Query =
"<Where><Or><Membership Type='CurrentUserGroups'><FieldRef Name='Users'/></Membership>" +
"<Eq><FieldRef Name='Users'/><Value Type='Integer'><UserID /></Value></Eq></Or></Where>";
var items = spList.GetItems(query);
I have attempted to use the ViewXml property instead, but no success either.
EDIT: I have removed the enclosing <Query>
tags as suggested, but now rather than returning all items, the query now return no items at all!