如何使用javascript和jquery从sharepoint列表中获取数据?

时间:2012-04-04 03:51:05

标签: javascript jquery sharepoint

我是分享点的新手。我想从sharepoint列表中使用javascript和jquery选择数据并在页面上显示。

1 个答案:

答案 0 :(得分:3)

Sharepoint 2010使用客户端对象模型

http://blogs.msdn.com/b/vesku/archive/2010/02/25/how-to-sharepoint-2010-js-client-object-model-and-ui-advancements.aspx

http://www.codeproject.com/Articles/60348/SharePoint-2010-Client-Object-Model-for-JavaScript

Sharepoint 2007使用以下代码

 <script language="javascript" type="text/javascript" src="jquery-1.4.3.min.js">   </script>
 <script language="javascript" src="jquery.SPServices-0.7.0.min.js"></script>
 <script type="text/javascript">

    $(document).ready(function () {
         $().SPServices({
            operation: "GetListItems",
            async: false,
            listName: "[LIST NAME]",
            CAMLViewFields: "<ViewFields><FieldRef Name=\"Status\" /><FieldRef Name=\"COLUMN NAME\" /><FieldRef Name=\"COLUMN NAME\" /></ViewFields>",
            completefunc: function (xData, Status) {
               $(xData.responseXML).SPFilterNode("z:row").each(function () {
                  var status = $(this).attr("ows_COLUMN NAME");
                  var createdDate = $(this).attr("ows_COLUMN NAME");

              });
          }
       });
});
</script>