• 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>

     

  • 相关阅读:
    剑指offer的前16题-java版
    JAVA基本数据类型所占字节数是多少?(32位系统)
    二叉树的镜像
    阿里简历问题
    javaSE基础总结
    小心情
    九九乘法表-for循环和while循环
    Python PEP8 编码规范及中文版
    比大小和猜数字
    猜拳游戏
  • 原文地址:https://www.cnblogs.com/systemnet123/p/7193345.html
Copyright © 2020-2023  润新知