为 AJAX 创建复合 SOAP 查询条件

发布于 11-19 15:57 字数 1260 浏览 3 评论 0原文

我有一段使用 Jquery 与 Sharepoint 服务器通信并从 sharepoint 获取列表数据的代码。该过滤器是用 SOAP 信封指定的,即下面的代码。目前它只有一个查询条件(查询标记内的代码),但是我希望有两个或多个条件并用 AND 逻辑将它们串在一起。任何帮助将不胜感激!

soapEnv =
    "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
        <soapenv:Body> \
             <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                <listName>Risks Issues</listName> \
                 <query>\
                   <Query>\
                      <Where>\
                         <Eq>\
                           <FieldRef Name='Project'/>\
                           <Value Type='Text'>XYZ</Value>\
                         </Eq>\
                       </Where>\
                   </Query>\
                 </query> \
                <viewFields> \
                    <ViewFields> \
                       <FieldRef Name='Urgency' /> \
                           <FieldRef Name='Item Type' /> \
                   </ViewFields> \
                </viewFields> \
            </GetListItems> \
        </soapenv:Body> \
    </soapenv:Envelope>";

I have a piece of code using Jquery to talk to Sharepoint server and get list data out of sharepoint. The filter is specified with a SOAP enevelope, which is the code below. Currently it has only one query conditon (the code within the query tag), however I would like to have two or more conditions and string them together with AND logic. Any help will be much appreciated!

soapEnv =
    "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
        <soapenv:Body> \
             <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                <listName>Risks Issues</listName> \
                 <query>\
                   <Query>\
                      <Where>\
                         <Eq>\
                           <FieldRef Name='Project'/>\
                           <Value Type='Text'>XYZ</Value>\
                         </Eq>\
                       </Where>\
                   </Query>\
                 </query> \
                <viewFields> \
                    <ViewFields> \
                       <FieldRef Name='Urgency' /> \
                           <FieldRef Name='Item Type' /> \
                   </ViewFields> \
                </viewFields> \
            </GetListItems> \
        </soapenv:Body> \
    </soapenv:Envelope>";

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赤濁2024-11-26 15:57:51

对 where 子句使用 此类语法

<Where>\
   <And>\
     <Eq>\
       <FieldRef Name='Project'/>\
       <Value Type='Text'>XYZ</Value>\
     </Eq>\
     <Eq>\
       <FieldRef Name='Project'/>\
       <Value Type='Text'>XYZ</Value>\
     </Eq>\
   </And>\
 </Where>\

use such syntax for your where clause:

<Where>\
   <And>\
     <Eq>\
       <FieldRef Name='Project'/>\
       <Value Type='Text'>XYZ</Value>\
     </Eq>\
     <Eq>\
       <FieldRef Name='Project'/>\
       <Value Type='Text'>XYZ</Value>\
     </Eq>\
   </And>\
 </Where>\
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文