views:

23

answers:

1

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/'&gt; \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt; \
                        <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>

Any help or suggestions would be appreciated

+1  A: 

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/'&gt; \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt; \
                    <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>";
Joel
Fantastic! This works great. Thank you so much for your help!
Steve Barber