SharePoint文件夹QueryOptions不适用于JQuery

时间:2010-08-16 10:37:39

标签: jquery sharepoint

使用JQuery时,似乎忽略了该选项。这只会带回根文件夹。这是我的代码:

<script type="text/javascript">
   $(document).ready(function() {
      var serviceName = "http://win2k3r2ee:90/_vti_bin/lists.asmx";

      var postData =
    "<soapenv:Envelope  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>Development</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='Title' /> \
                           </ViewFields> \
                        </viewFields> \
                        <Query> \
                           <QueryOptions> \
                              <Folder>Development/CSS</Folder> \
                           </QueryOptions > \
                          <OrderBy>  \
                            <FieldRef Name='ID' Ascending='True' />  \
                          </OrderBy>  \
                        </Query>  \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";

      $.ajax({
         url: serviceName,
         type: "POST",
         dataType: "xml",
         data: postData,
         complete: processPosts,
         contentType: "text/xml; charset=\"utf-8\""
      });
   });

   function processPosts(xData, status) {
      $(xData.responseXML).find("z\\:row").each(function() {
         if (status == "success") {
            var test = $(this).attr("ows_FileLeafRef");
            $("#myDiv").append(test + "<br>");
         }
      });
   }

</script>

任何帮助或建议都将不胜感激

1 个答案:

答案 0 :(得分:2)

QueryOptions位于QueryOptions(注释大小写)内,不在Query内部。查询进入查询。悲伤却又是真的。

尝试:

var postData =
"<soapenv:Envelope  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>Development</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Title' /> \
                       </ViewFields> \
                    </viewFields> \
                    <query> \
                      <Query> \
                        <OrderBy>  \
                          <FieldRef Name='ID' Ascending='True' />  \
                        </OrderBy>  \
                      </Query> \
                    </query> \
                    <queryOptions> \
                       <QueryOptions> \
                          <Folder>Development/CSS</Folder> \
                       </QueryOptions > \
                    </queryOptions>  \
                </GetListItems> \
            </soapenv:Body> \
        </soapenv:Envelope>";