accessing sharepoint list using javascript - Stack Overflow

hi How to access sharepoint list from javascript using ajax?I am getting 404 error everytime.var d =&

hi How to access sharepoint list from javascript using ajax? I am getting 404 error everytime.

     var d ="<?xml version=\"1.0\" encoding=\"utf-8\<soap:Envelope xmlns:xsi=\"\" xmlns:xsd=\"\" xmlns:soap=\"/\">
<soap:Body><GetListItems xmlns=\"/\">
<listName>TEST</listName>
<queryOptions></queryOptions>
<query><Query><Where><Eq><FieldRef Name=\"Title\"/><Value Type=\"Text\">title</Value></Eq></Where></Query></query>
</GetListItems>
</soap:Body></soap:Envelope>";

Can someone check if Soap envelope is correct?

hi How to access sharepoint list from javascript using ajax? I am getting 404 error everytime.

     var d ="<?xml version=\"1.0\" encoding=\"utf-8\<soap:Envelope xmlns:xsi=\"http://www.w3/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap/soap/envelope/\">
<soap:Body><GetListItems xmlns=\"http://schemas.microsoft./sharepoint/soap/\">
<listName>TEST</listName>
<queryOptions></queryOptions>
<query><Query><Where><Eq><FieldRef Name=\"Title\"/><Value Type=\"Text\">title</Value></Eq></Where></Query></query>
</GetListItems>
</soap:Body></soap:Envelope>";

Can someone check if Soap envelope is correct?

Share Improve this question edited Feb 8, 2011 at 18:59 santosh singh 28.7k27 gold badges87 silver badges133 bronze badges asked Feb 8, 2011 at 18:30 Dammanjit RainaDammanjit Raina 211 silver badge3 bronze badges 1
  • Using single quotes (') to enclose that string would save you the trouble of having to escape all the internal quotes. – Marc B Commented Feb 8, 2011 at 19:17
Add a ment  | 

1 Answer 1

Reset to default 4

It would be easyer to use a library instead of forging soap envelopes yourself. Try SPServices, a jQuery library for SharePoint web services.

Then you just do something like:

<script type="text/javascript" src="filelink/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="filelink/jquery.SPServices-0.5.4.min.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Announcements",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    pletefunc: function (xData, Status) {
      $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        $("#tasksUL").append(liHtml);
      });
    }
  });
});
</script>
<ul id="tasksUL"/>

Nice!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745083668a4610276.html

相关推荐

  • accessing sharepoint list using javascript - Stack Overflow

    hi How to access sharepoint list from javascript using ajax?I am getting 404 error everytime.var d =&

    16小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信