获取网站网站页面列表中的页面

命名空间:microsoft.graph

重要

Microsoft Graph 中版本下的 /beta API 可能会更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 在 v1.0 中是否可用,请使用 版本 选择器。

返回网站中网站列表中的 sitePage 的元数据。

权限

调用此 API 需要以下权限之一。 若要了解详细信息,包括如何选择权限的信息,请参阅权限

权限类型 权限(从最低特权到最高特权)
委派(工作或学校帐户) Sites.Read.All、Sites.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。
应用程序 Sites.Read.All、Sites.ReadWrite.All

HTTP 请求

GET /sites/{site-id}/pages/{page-id}

示例

示例 1:获取网站网站页面列表中的页面

请求

GET /sites/{site-id}/pages/{page-id}

响应

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.type": "microsoft.graph.sitePage",
  "description": "Here's the page description",
  "id": "65e59907-59d5-44ff-a038-7c0bf3098c01",
  "name": "Home.aspx",
  "webUrl": "SitePages/Home.aspx",
  "title": "Organization Home",
  "thumbnailWebUrl": "https://cdn.hubblecontent.osi.office.net/m365content/publish/00210d24-bba0-42e6-9a31-1d452a95dd75/thumbnails/large.jpg?file=163352059.jpg",
  "promotionKind": "page",
  "pageLayout": "home",
  "showComments": true,
  "showRecommendedPages": false,
  "createdBy": {
    "user": {
        "displayName": "Rahul Mittal",
        "email": "rahmit@contoso.com"
    }
  },
  "lastModifiedBy": {
    "user": {
        "displayName": "Rahul Mittal",
        "email": "rahmit@contoso.com"
    }
  },
  "publishingState": {
    "level": "published",
    "versionId": "1.0"
  },
  "reactions": {
    "commentCount": 1
  }
}

示例 2:使用 select 和 expand 获取页面

请求

使用 selectexpand 语句,可以在单个请求中检索 sitePage 元数据和页面内容。

GET https://graph.microsoft.com/beta/sites/{sitesId}/pages/{sitePageId}?select=id,title&expand=webparts

响应

下面是响应的示例

HTTP/1.1 200 OK
Content-type: application/json

{
  "@odata.type": "microsoft.graph.sitePage",
  "id": "65e59907-59d5-44ff-a038-7c0bf3098c01",
  "title": "Organization Home",
  "webparts":[{
      "@odata.type": "#microsoft.graph.textWebPart",
      "id": "d79d70af-27ea-4208-8dce-23c3bf678664",
      "innerHtml": "<h2>How do you get started?</h2>"
    },
    {
      "@odata.type": "#microsoft.graph.textWebPart",
      "id": "6346d908-f20d-4528-902f-3c2a9c8c2442",
      "webPartType": "d1d91016-032f-456d-98a4-721247c305e8",
      "data": {
        "dataVersion": "1.9",
        "description": "Show an image on your page",
        "title": "Image",
        "properties": {
          "imageSourceType": 2,
          "altText": "",
          "overlayText": "",
          "siteid": "0264cabe-6b92-450a-b162-b0c3d54fe5e8",
          "webid": "f3989670-cd37-4514-8ccb-0f7c2cbe5314",
          "listid": "bdb41041-eb06-474e-ac29-87093386bb14",
          "uniqueid": "d9f94b40-78ba-48d0-a39f-3cb23c2fe7eb",
          "imgWidth": 4288,
          "imgHeight": 2848,
          "fixAspectRatio": false,
          "captionText": "",
          "alignment": "Center"
        },
        "serverProcessedContent": {
          "imageSources": [
            {
              "key": "imageSource",
              "value": "/_LAYOUTS/IMAGES/VISUALTEMPLATEIMAGE1.JPG"
            }
          ],
          "customMetadata": [
            {
              "key": "imageSource",
              "value": {
                "siteid": "0264cabe-6b92-450a-b162-b0c3d54fe5e8",
                "webid": "f3989670-cd37-4514-8ccb-0f7c2cbe5314",
                "listid": "bdb41041-eb06-474e-ac29-87093386bb14",
                "uniqueid": "d9f94b40-78ba-48d0-a39f-3cb23c2fe7eb",
                "width": "4288",
                "height": "2848"
              }
            }
          ]
        }
      }
    }]
}