SharePoint CAML Query AND/OR operators

你离开我真会死。 提交于 2019-12-11 01:28:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!