| author | Yadong1106 |
|---|---|
| description | Save the current page as a template. |
| title | sitePage: saveAsTemplate |
| ms.localizationpriority | medium |
| ms.subservice | sharepoint |
| doc_type | apiPageType |
| ms.date | 10/21/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Save a sitePage as a pageTemplate in a site.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
POST /sites/{siteId}/pages/{pageId}/microsoft.graph.sitePage/saveAsTemplate| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
In the request body, supply a JSON representation of the saveAsTemplate to use in the request payload.
If successful, this method returns a 201 Created HTTP response and the created pageTemplate object.
The following example shows how to save a site page as a template page.
POST /sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pages/f6ed8c43-9923-4c6c-ba09-9c32b8f10aeb/microsoft.graph.sitePage/saveAsTemplate
Content-Type: application/json
{
"title": "SampleTitle",
"name": "SampleTemplate.aspx"
}
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "microsoft.graph.pageTemplate",
"id": "0dd6ddd6-45bd-4acd-b683-de0e6e726371",
"name": "SampleTemplate.aspx",
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/Sample.aspx",
"title": "SampleTitle",
"pageLayout": "article",
"createdBy": {
"user": {
"displayName": "Rahul Mittal",
"email": "rahmit@contoso.com"
}
},
"lastModifiedBy": {
"user": {
"displayName": "Rahul Mittal",
"email": "rahmit@contoso.com"
}
},
"publishingState": {
"level": "checkout",
"versionId": "0.1",
"checkedOutBy": {
"user": {
"displayName": "Rahul Mittal",
"email": "rahmit@contoso.com"
}
}
},
"titleArea": {
"enableGradientEffect": true,
"imageWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
"layout": "colorBlock",
"showAuthor": true,
"showPublishedDate": false,
"showTextBlockAboveTitle": false,
"textAboveTitle": "TEXT ABOVE TITLE",
"textAlignment": "left",
"imageSourceType": 2
}
}