问题
I would appreciate any help on getting my CAML query to work. I have the following list:
| ID | Department | Status |
I am trying to get the query to return list items where ID=1, Department=Audit, and Status= "Stopped" OR "In Progress".
Can anyone please help?
Regards,
回答1:
Query:
<Query>
<Where>
<And>
<Eq>
<FieldRef Name='ID' />
<Value Type='Counter'>1</Value>
</Eq>
<And>
<Eq>
<FieldRef Name='Department' />
<Value Type='Choice'>Audit</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name='Status' />
<Value Type='Choice'>In Progress</Value>
</Eq>
<Eq>
<FieldRef Name='Status' />
<Value Type='Choice'>Not Started</Value>
</Eq>
</Or>
</And>
</And>
</Where>
</Query>
Note: it is assumed that Department is a
Choice
field
I would recommend you to utilize the tool that will help you build your CAML Queries, for example U2U Caml Query Builder
来源:https://stackoverflow.com/questions/23372443/sharepoint-caml-query-and-or-operators