2010-08-16 40 views
1

使用JQuery时,该选项似乎被忽略。这只会带回根文件夹。这里是我的代码:SharePoint文件夹QueryOptions不适用于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> 

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

+0

这个问题不交代不知道的是,*响应*看起来像:) – 2010-08-16 10:44:33

回答

2

QueryOptions走了进去queryOptions(注意大小写),不中查询。查询进入查询。悲伤但真实。

尝试:

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>"; 
+0

太棒了!这很好。非常感谢你的帮助! – 2010-08-17 09:44:19

相关问题