开发者

SharePoint Folder QueryOptions Does Not Work With JQuery

The option seems to be ignored when using JQuery. This will only bring back the root folder. Here is my code:

<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: postD开发者_高级运维ata,
         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>

Any help or suggestions would be appreciated


QueryOptions goes inside queryOptions (note case) not inside of Query. Query goes inside a query. Sad but true.

Try:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜