• Project Server 2016 RestAPI调用测试


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ Page Language="C#" %>
    <%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta name="WebPartPageExpansion" content="full"/>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>测试Project Server RestAPI</title>
        <meta http-equiv="X-UA-Compatible" content="IE=10"/>
        <SharePoint:CssRegistration Name="default" runat="server"/>
        <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
        <script type="text/javascript">
    
            requestProjectApi("","/sites/pwa/_api/ProjectServer/Projects",function (data) {
                var projectdata_html = "";
                $(data).each(function (index, item) {
                    projectdata_html += "<tr>";
                    projectdata_html += "<td>"+(index+1)+"</td>";
                    projectdata_html += "<td>"+item.Name+"</td>";
                    projectdata_html += "<td>"+item.CreatedDate+"</td>";
                    projectdata_html += "</tr>";
                });
                $("#tb_projectdata").html(projectdata_html);
            })
    
            function requestProjectApi (postData,postUrl,callBack) {
                $.ajax({
                    url: postUrl,
                    type: "GET",
                    contentType: "application/json",
                    data: postData,
                    headers: {
                        "Accept": "application/json; odata=verbose",
                    },
                    complete: function (xhr, textStatus) {
                        if (xhr.status == 200) {
                            var jsondata = JSON.parse(xhr.responseText).d.results;
                            if(callBack){
                                callBack(jsondata);
                            }
                        }
                    },
                    error: function (data, errorCode, errorMessage) {
                    }
                });
            }
        </script>
    </head>
    <body>
    <form id="form1" runat="server">
        <table>
            <thead>
            <tr>
                <th>序号</th>
                <th>项目名称</th>
                <th>创建日期</th>
            </tr>
            </thead>
            <tbody id="tb_projectdata">
            </tbody>
        </table>
    </form>
    </body>
    </html>

     

  • 相关阅读:
    浮动 无刷新 div
    vidalia 更换浏览器代理
    vb 主动 点击 a
    Delphi 资料收集
    用Linux的iptables和Python模拟广域网
    框架资源
    div 边框
    Google App Engine
    mac 雪豹 10.6 五国
    Windows Azure Storage (3) Windows Azure Storage Service存储服务之Blob详解(中)
  • 原文地址:https://www.cnblogs.com/systemnet123/p/7193345.html
Copyright © 2020-2023  润新知