Skip to content

Commit d4a4ac0

Browse files
authored
Merge pull request #25444 from microsoftgraph/user/yadongzhai/updatebetadocument
Update the pagetemplate code sample for beat API
2 parents 1449c2d + d2f04f1 commit d4a4ac0

10 files changed

+223
-44
lines changed

api-reference/beta/api/pagetemplate-create.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Content-Type: application/json
7373
"showRecommendedPages": false,
7474
"titleArea": {
7575
"enableGradientEffect": true,
76-
"imageWebUrl": "/_LAYOUTS/IMAGES/VISUALTEMPLATETITLEIMAGE.JPG",
76+
"imageWebUrl": "https://media.contoso.odsp.cdn.office.net/sitepagethumbnail.png",
7777
"layout": "colorBlock",
7878
"showAuthor": true,
7979
"showPublishedDate": false,
@@ -165,7 +165,7 @@ Content-Type: application/json
165165

166166
### Response
167167

168-
The following example shows the response.
168+
The following example shows the response that contains a [pageTemplate](../resources/pagetemplate.md) object for the created page template.
169169

170170
> **Note:** The response might be shortened for readability.
171171
@@ -179,7 +179,7 @@ Content-type: application/json
179179
"@odata.type": "microsoft.graph.pageTemplate",
180180
"id": "0dd6ddd6-45bd-4acd-b683-de0e6e726371",
181181
"name": "test.aspx",
182-
"webUrl": "https://a830edad9050849yd.sharepoint.com/SitePages/Templates/test.aspx",
182+
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/test.aspx",
183183
"title": "test",
184184
"pageLayout": "article",
185185
"showComments": true,
@@ -208,7 +208,7 @@ Content-type: application/json
208208
},
209209
"titleArea": {
210210
"enableGradientEffect": true,
211-
"imageWebUrl": "/_LAYOUTS/IMAGES/VISUALTEMPLATETITLEIMAGE.JPG",
211+
"imageWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
212212
"layout": "colorBlock",
213213
"showAuthor": true,
214214
"showPublishedDate": false,

api-reference/beta/api/pagetemplate-delete.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Choose the permission or permissions marked as least privileged for this API. Us
2626
<!-- { "blockType": "ignored" } -->
2727

2828
```http
29-
DELETE /sites/{site-id}/pageTemplates/microsoft.graph.pageTemplate/{pageTemplate-id}
29+
DELETE /sites/{site-id}/pageTemplates/{pageTemplate-id}/microsoft.graph.pageTemplate
3030
```
3131

3232
## Request headers
@@ -50,18 +50,12 @@ If successful, this method returns a `204 No Content` HTTP response. It doesn't
5050

5151
The following example shows a request.
5252

53-
# [HTTP](#tab/http)
5453
<!-- { "blockType": "request", "name": "delete-pageTemplate", "scopes": "files.readwrite sites.readwrite.all" } -->
54+
5555
```http
56-
DELETE /sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pageTemplates/microsoft.graph.pageTemplate/7bf14f9b-8764-4e54-bc5a-ee7d83dd09f7
56+
DELETE https://graph.microsoft.com/beta/sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pageTemplates/7bf14f9b-8764-4e54-bc5a-ee7d83dd09f7/microsoft.graph.pageTemplate
5757
```
5858

59-
# [JavaScript](#tab/javascript)
60-
[!INCLUDE [sample-code](../includes/snippets/javascript/delete-pagetemplate-javascript-snippets.md)]
61-
[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)]
62-
63-
---
64-
6559
### Response
6660

6761
The following example shows the response.

api-reference/beta/api/pagetemplate-get.md

Lines changed: 162 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ Choose the permission or permissions marked as least privileged for this API. Us
2727
<!-- { "blockType": "ignored" } -->
2828

2929
```http
30-
GET /sites/{site-id}/pageTemplates/microsoft.graph.pageTemplate/{page-template-id}
30+
GET /sites/{site-id}/pageTemplates/{page-template-id}/microsoft.graph.pageTemplate
3131
```
3232

3333
## Optional query parameters
3434

3535
This method supports the `$select` and `$expand` OData query parameters to help customize the response. For general information, see [OData query parameters](/graph/query-parameters).
3636

37-
You can use the `$expand=canvasLayout` query parameter to include the content of an item when you retrieve the metadata of an item if the item has a **canvasLayout** relationship.
37+
You can use the `$expand=canvasLayout` query parameter to include the content of an item when you retrieve its metadata if the item has a **canvasLayout** relationship.
3838

3939

4040
## Request headers
@@ -56,23 +56,20 @@ If successful, this method returns a `200 OK` and a [pageTemplate](../resources/
5656

5757
## Examples
5858

59+
### Example 1: Get a page template in the templates folder of a site
60+
61+
The following example shows how to get a page template in the templates folder of a SharePoint site.
62+
5963
#### Request
6064

6165
The following example shows a request.
6266

63-
# [HTTP](#tab/http)
64-
<!-- { "blockType": "request", "name": "get-pageTemplate", "scopes": "sites.read.all", "tags": "service.sharepoint" } -->
67+
<!-- { "blockType": "request", "name": "get-pageTemplate_1", "scopes": "sites.read.all", "tags": "service.sharepoint" } -->
6568

6669
```msgraph-interactive
67-
GET /sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pageTemplates/microsoft.graph.pageTemplate/f6ed8c43-9923-4c6c-ba09-9c32b8f10aeb
70+
GET https://graph.microsoft.com/beta/sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pageTemplates/f6ed8c43-9923-4c6c-ba09-9c32b8f10aeb/microsoft.graph.pageTemplate
6871
```
6972

70-
# [JavaScript](#tab/javascript)
71-
[!INCLUDE [sample-code](../includes/snippets/javascript/get-pagetemplate-javascript-snippets.md)]
72-
[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)]
73-
74-
---
75-
7673
#### Response
7774

7875
The following example shows the response.
@@ -88,9 +85,9 @@ Content-type: application/json
8885
"description": "Here's the page description",
8986
"id": "65e59907-59d5-44ff-a038-7c0bf3034567",
9087
"name": "Home.aspx",
91-
"webUrl": "https://a830edad9050849rahmit.sharepoint.com/SitePages/Templates/Home.aspx",
88+
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/Home.aspx",
9289
"title": "Organization Home",
93-
"thumbnailWebUrl": "https://cdn.hubblecontent.osi.office.net/m365content/publish/00210d24-bba0-42e6-9a31-1d452a95dd75/thumbnails/large.jpg?file=163352059.jpg",
90+
"thumbnailWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
9491
"promotionKind": "page",
9592
"pageLayout": "home",
9693
"showComments": true,
@@ -117,6 +114,158 @@ Content-type: application/json
117114
}
118115
```
119116

117+
### Example 2: Get a page template using $select
118+
119+
The following example shows how to use the `$select` query parameter to retrieve specific properties of a page template.
120+
121+
#### Request
122+
123+
The following example shows a request.
124+
125+
<!-- {
126+
"blockType": "request",
127+
"name": "get_pageTemplate_2"
128+
}
129+
-->
130+
```msgraph-interactive
131+
GET https://graph.microsoft.com/beta/sites/7f50f45e-714a-4264-9c59-3bf43ea4db8f/pageTemplates/df69e386-6c58-4df2-afc0-ab6327d5b202/microsoft.graph.pageTemplate?$select=id,name
132+
```
133+
134+
#### Response
135+
136+
The following example shows the response.
137+
138+
<!-- {
139+
"blockType": "response",
140+
"@odata.type": "microsoft.graph.pageTemplate",
141+
"truncated": true
142+
} -->
143+
```http
144+
HTTP/1.1 200 OK
145+
Content-type: application/json
146+
147+
{
148+
"@odata.etag": "\"{F45354CB-D634-45DF-8B88-2B4E96A1DC45},8\"",
149+
"id": "f45354cb-d634-45df-8b88-2b4e96a1dc45",
150+
"name": "Electronic Convertible.aspx"
151+
}
152+
```
153+
154+
### Example 3: Get a page template with canvas content using $expand
155+
156+
The following example shows how to use the `$expand` query parameter to access the page template and its content with `?$expand=canvasLayout`.
157+
158+
#### Request
159+
160+
The following example shows a request.
161+
162+
<!-- {
163+
"blockType": "request",
164+
"name": "get_pageTemplate_3"
165+
}
166+
-->
167+
```http
168+
GET https://graph.microsoft.com/beta/sites/7f50f45e-714a-4264-9c59-3bf43ea4db8f/pageTemplates/df69e386-6c58-4df2-afc0-ab6327d5b202/microsoft.graph.pageTemplate?$expand=canvasLayout
169+
```
170+
171+
#### Response
172+
173+
The following example shows the response.
174+
175+
<!-- {
176+
"blockType": "response",
177+
"@odata.type": "microsoft.graph.pageTemplate",
178+
"truncated": true
179+
} -->
180+
```http
181+
HTTP/1.1 200 OK
182+
Content-type: application/json
183+
184+
{
185+
"description": "Reiciendis placeat dolores.",
186+
"eTag": "\"{F45354CB-D634-45DF-8B88-2B4E96A1DC45},8\"",
187+
"id": "f45354cb-d634-45df-8b88-2b4e96a1dc45",
188+
"lastModifiedDateTime": "2023-04-16T10:01:41Z",
189+
"name": "autotest Electronic Convertible.aspx",
190+
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/Home.aspx",
191+
"title": "autotest Electronic Convertible",
192+
"pageLayout": "article",
193+
"thumbnailWebUrl": "https://media.contoso.odsp.cdn.office.net/sitepagethumbnail.png",
194+
"promotionKind": "page",
195+
"showComments": false,
196+
"showRecommendedPages": true,
197+
"createdBy": {
198+
"user": {
199+
"displayName": "Rahul Mittal",
200+
"email": "rahmit@contoso.com"
201+
}
202+
},
203+
"lastModifiedBy": {
204+
"user": {
205+
"displayName": "Rahul Mittal",
206+
"email": "rahmit@contoso.com"
207+
}
208+
},
209+
"parentReference": {
210+
"listId": "468fc883-e278-4773-ba09-91351a1e42ed",
211+
"siteId": "45bb2a3b-0a4e-46f4-8c68-749c3fea75d3"
212+
},
213+
"contentType": {
214+
"id": "0x0101009D1CB255DA76424F860D91F20E6C4118009E6554A5E299E84FB2E07731DD6C6D4A",
215+
"name": "Site Page"
216+
},
217+
"publishingState": {
218+
"level": "draft",
219+
"versionId": "0.4"
220+
},
221+
"reactions": {},
222+
"canvasLayout": {
223+
"horizontalSections": [
224+
{
225+
"layout": "threeColumns",
226+
"id": "1",
227+
"emphasis": "neutral",
228+
"columns": [
229+
{
230+
"id": "1",
231+
"width": 4,
232+
"webparts": [
233+
{
234+
"@odata.type": "#oneDrive.textWebPart",
235+
"id": "f6d0ef70-c977-45e4-ae4b-4676a30d5aab",
236+
"innerHtml": "<h1>sample content</h1>"
237+
}
238+
]
239+
},
240+
{
241+
"id": "2",
242+
"width": 4,
243+
"webparts": [
244+
{
245+
"@odata.type": "#oneDrive.textWebPart",
246+
"id": "99f59f91-c853-433e-9e75-ad7a32e46106",
247+
"innerHtml": "<h1>sample content</h1>"
248+
}
249+
]
250+
},
251+
{
252+
"id": "3",
253+
"width": 4,
254+
"webparts": [
255+
{
256+
"@odata.type": "#oneDrive.textWebPart",
257+
"id": "48998492-9633-48b8-a7e9-d293533b4fa6",
258+
"innerHtml": "<h1>sample content</h1>"
259+
}
260+
]
261+
}
262+
]
263+
}
264+
]
265+
}
266+
}
267+
```
268+
120269
<!--
121270
{
122271
"type": "#pageTemplate.annotation",

api-reference/beta/api/pagetemplate-list.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Content-type: application/json
119119
{
120120
"id": "08f48aa6-02e3-407c-bbcb-ff61cec653fa",
121121
"name": "sample.aspx",
122-
"webUrl": "https://a830edad9050849yd.sharepoint.com/SitePages/Templates/sample.aspx",
122+
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/sample.aspx",
123123
"title": "sample",
124124
"pageLayout": "article",
125125
"showComments": true,
@@ -152,7 +152,7 @@ Content-type: application/json
152152
},
153153
"titleArea": {
154154
"enableGradientEffect": true,
155-
"imageWebUrl": "/_LAYOUTS/IMAGES/SLEEKTEMPLATEIMAGETILE.JPG",
155+
"imageWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
156156
"layout": "imageAndTitle",
157157
"showAuthor": false,
158158
"showPublishedDate": false,
@@ -166,7 +166,7 @@ Content-type: application/json
166166
{
167167
"id": "7d87eee1-7c77-46b5-b2c4-ad6e4e432a8e",
168168
"name": "Home.aspx",
169-
"webUrl": "https://a830edad9050849yd.sharepoint.com/SitePages/Templates/Home.aspx",
169+
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/Home.aspx",
170170
"title": "Home",
171171
"pageLayout": "home",
172172
"showComments": true,
@@ -198,7 +198,7 @@ Content-type: application/json
198198
},
199199
"titleArea": {
200200
"enableGradientEffect": true,
201-
"imageWebUrl": "/siteAssets/titleBackground.jpg",
201+
"imageWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
202202
"layout": "imageAndTitle",
203203
"showAuthor": true,
204204
"showPublishedDate": false,

api-reference/beta/api/pagetemplate-update.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Choose the permission or permissions marked as least privileged for this API. Us
3030
-->
3131

3232
```http
33-
PATCH /sites/{sitesId}/pageTemplates/microsoft.graph.pageTemplate/{page-template-id}
33+
PATCH /sites/{site-id}/pageTemplates/{page-template-id}/microsoft.graph.pageTemplate
3434
```
3535

3636
## Request headers
@@ -64,15 +64,14 @@ If successful, this method returns a `200 OK` response code and an updated [page
6464

6565
The following example shows a request.
6666

67-
# [HTTP](#tab/http)
6867
<!-- {
6968
"blockType": "request",
7069
"name": "update_pageTemplate"
7170
}
7271
-->
7372

7473
```http
75-
PATCH /sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pageTemplates/microsoft.graph.pageTemplate/8fbff3f5-0e5d-49e7-89c7-2b042b3bfaa6
74+
PATCH https://graph.microsoft.com/beta/sites/dd00d52e-0db7-4d5f-8269-90060ac688d1/pageTemplates/8fbff3f5-0e5d-49e7-89c7-2b042b3bfaa6/microsoft.graph.pageTemplate
7675
Content-Type: application/json
7776
7877
{
@@ -82,12 +81,6 @@ Content-Type: application/json
8281
}
8382
```
8483

85-
# [JavaScript](#tab/javascript)
86-
[!INCLUDE [sample-code](../includes/snippets/javascript/update-pagetemplate-javascript-snippets.md)]
87-
[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)]
88-
89-
---
90-
9184
### Response
9285

9386
The following example shows the response.
@@ -109,7 +102,7 @@ Content-Type: application/json
109102
"@odata.type": "#microsoft.graph.pageTemplate",
110103
"id": "0dd6ddd6-45bd-4acd-b683-de0e6e7231b7",
111104
"name": "sample.aspx",
112-
"webUrl": "https://a830edad9050849yd.sharepoint.com/SitePages/Templates/sample.aspx",
105+
"webUrl": "https://contoso.sharepoint.com/SitePages/Templates/sample.aspx",
113106
"title": "sample",
114107
"pageLayout": "article",
115108
"showComments": true,
@@ -138,7 +131,7 @@ Content-Type: application/json
138131
},
139132
"titleArea": {
140133
"enableGradientEffect": true,
141-
"imageWebUrl": "/_LAYOUTS/IMAGES/VISUALTEMPLATETITLEIMAGE.JPG",
134+
"imageWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
142135
"layout": "colorBlock",
143136
"showAuthor": true,
144137
"showPublishedDate": false,

api-reference/beta/api/sitepage-createfromtemplate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Content-Type: application/json
6060
{
6161
"title": "Sample",
6262
"name": "Sample.aspx",
63-
"id": "f6ed8c43-9923-4c6c-ba09-9c32b8f10aeb"
63+
"templateId": "f6ed8c43-9923-4c6c-ba09-9c32b8f10aeb"
6464
}
6565
6666
```
@@ -116,7 +116,7 @@ Content-type: application/json
116116
},
117117
"titleArea": {
118118
"enableGradientEffect": true,
119-
"imageWebUrl": "/_LAYOUTS/IMAGES/VISUALTEMPLATETITLEIMAGE.JPG",
119+
"imageWebUrl": "https://cdn.contoso.osi.office.net/m365content/publish/005292d6-9dcc-4fc5-b50b-b2d0383a411b/image.jpg",
120120
"layout": "colorBlock",
121121
"showAuthor": true,
122122
"showPublishedDate": false,

0 commit comments

Comments
 (0)