在网站的网站页面列表中创建页面
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
在网站 中的网站页面[列表中创建新的][] [sitePage。][] [][]
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | Sites.ReadWrite.All |
| 委派(个人 Microsoft 帐户) | 不支持。 |
| 应用程序 | Sites.ReadWrite.All |
HTTP 请求
POST /sites/{site-id}/pages
请求正文
在请求正文中,提供要创建的 sitePage 资源的 JSON 表示形式。
示例
以下示例演示如何创建新页面。
POST /sites/{site-id}/pages
Content-Type: application/json
{
"name": "Events.aspx",
"title": "Team Events",
"publishingState": {
"level": "checkedOut",
"versionId": "0.1"
},
"webParts": [
{
"type": "rte",
"data": {
"innerHTML": "<p>Here are the team's upcoming events:</p>"
}
},
{
"type": "d1d91016-032f-456d-98a4-721247c305e8",
"data": {
"title": "Events",
"description": "Display upcoming events",
"serverProcessedContent": {
"htmlStrings": {},
"searchablePlainTexts": {
"title": ""
},
"imageSources": {},
"links": {
"baseUrl": "https://www.contoso.com/sites/Engineering"
},
"componentDependencies": {
"layoutComponentId": "8ac0c53c-e8d0-4e3e-87d0-7449eb0d4027"
}
},
"dataVersion": "1.0",
"properties": {
"selectedListId": "032e08ab-89b0-4d8f-bc10-73094233615c",
"selectedCategory": "",
"dateRangeOption": 0,
"startDate": "",
"endDate": "",
"isOnSeeAllPage": false,
"layoutId": "FilmStrip",
"dataProviderId": "Event",
"webId": "0764c419-1ecc-4126-ba32-0c25ae0fffe8",
"siteId": "6b4ffc7a-cfc2-4a76-903a-1cc3686dee23"
}
}
}
]
}
响应
如果成功,此方法在已创建页面的响应正文中返回[sitePage。][]
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "2",
"eTag": "75bc70e2-6587-45be-8493-c99a956b2e05,7",
"createdDateTime": "2016-12-06T20:04:40Z",
"lastModifiedDateTime": "2016-12-06T20:05:09Z",
"webUrl": "https://www.contoso.com/sites/Engineering/SitePages/Events.aspx",
"createdBy": {
"user": {
"email": "rahmit",
"id": "1b37d2e1-5000-4648-b431-7dfa509b5660",
"displayName": "Rahul Mittal"
}
},
"lastModifiedBy": {
"user": {
"email": "rahmit",
"id": "1b37d2e1-5000-4648-b431-7dfa509b5660",
"displayName": "Rahul Mittal"
}
},
"parentReference": {
"id": "eb3bfd48-56f8-4c1e-8312-e58588b22e7c"
},
"contentType": {
"id": "0x0101009D1CB255DA76424F860D91F20E6C411800C9E7033636784C4B88A284B1823C45FD",
"name": "Site Page"
},
"description": "",
"title": "Team Events",
"webParts": [
{
"type": "rte",
"data": {
"innerHTML": "<p>Here are the team's upcoming events:</p>"
}
},
{
"type": "d1d91016-032f-456d-98a4-721247c305e8",
"data": {
"title": "Events",
"description": "Display upcoming events",
"serverProcessedContent": {
"htmlStrings": {},
"searchablePlainTexts": {
"title": ""
},
"imageSources": {},
"links": {
"baseUrl": "https://www.contoso.com/teams/Engineering"
},
"componentDependencies": {
"layoutComponentId": "8ac0c53c-e8d0-4e3e-87d0-7449eb0d4027"
}
},
"dataVersion": "1.0",
"properties": {
"selectedListId": "032e08ab-89b0-4d8f-bc10-73094233615c",
"selectedCategory": "",
"dateRangeOption": 0,
"startDate": "",
"endDate": "",
"isOnSeeAllPage": false,
"layoutId": "FilmStrip",
"dataProviderId": "Event",
"webId": "0764c419-1ecc-4126-ba32-0c25ae0fffe8",
"siteId": "6b4ffc7a-cfc2-4a76-903a-1cc3686dee23"
}
}
}
]
}
注意: 为清楚起见,将截断 Response 对象。 实际调用会返回默认属性。
反馈
提交和查看相关反馈