Skip to content

Commit dcff9bf

Browse files
authored
Merge pull request #25771 from microsoftgraph/newslinkpagedocs
NewsLinkPage Beta Documentation
2 parents 8c07814 + 963e760 commit dcff9bf

18 files changed

+1027
-23
lines changed
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
---
2+
title: "Create newsLinkPage"
3+
description: "Create a new news link page in the site pages list of a site."
4+
author: "shgangan"
5+
ms.date: 04/01/2024
6+
ms.localizationpriority: "medium"
7+
ms.subservice: "sharepoint"
8+
doc_type: "apiPageType"
9+
---
10+
11+
# Create newsLinkPage
12+
13+
Namespace: microsoft.graph
14+
15+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
16+
17+
Create a new [newsLinkPage](../resources/newslinkpage.md) in the site pages [list](../resources/list.md) of a [site](../resources/site.md).
18+
19+
## Permissions
20+
21+
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](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
22+
23+
<!-- { "blockType": "permissions", "name": "newslinkpage_create" } -->
24+
[!INCLUDE [permissions-table](../includes/permissions/newslinkpage-create-permissions.md)]
25+
26+
## HTTP request
27+
28+
<!-- {
29+
"blockType": "ignored"
30+
}
31+
-->
32+
```http
33+
POST /sites/{site-id}/pages
34+
```
35+
36+
## Request headers
37+
38+
|Name|Description|
39+
|:---|:---|
40+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
41+
|Content-Type|application/json for JSON content, including the required **title** property in multipart requests. Multipart requests use the multipart/form-data; boundary=your-boundary content type. Required. |
42+
|Prefer | include-unknown-enum-members. You must use the `Prefer: include-unknown-enum-members` request header to get the following value in [pageLayoutType](../resources/basesitepage.md#pagelayouttype-values), which is a [evolvable enum](/graph/best-practices-concept#handling-future-members-in-evolvable-enumerations): `newsLink`. |
43+
44+
## Request body
45+
46+
In the request body, supply a JSON representation of the [newsLinkPage](../resources/newslinkpage.md) object. The body must contain required properties placed directly in the request body; however, to set a banner image by uploading an image, it must be in a multipart message format as shown in the example. For the banner image upload, you must send a multipart request because it involves binary data.
47+
48+
> **Notes:**
49+
> * To ensure successful parsing of the request body, the `@odata.type=#microsoft.graph.newsLinkPage` must be included in the request body.
50+
> * Currently, to set the **bannerImageWebUrl**, the capability exists to upload the image bytes directly. These bytes get auto-saved in the site assets library, and the **bannerImageWebUrl** is then generated based on the persisted file. To achieve this, make a multipart request and set the `@microsoft.graph.bannerImageWebUrlContent` annotation to send the image content. For more details, see [Example 2](../api/newslinkpage-create.md#example-2-create-a-news-link-page-and-upload-the-banner-image-file-content).
51+
52+
You can specify the following properties when you create a [newsLinkPage](../resources/newslinkpage.md).
53+
54+
|Property|Type|Description|
55+
|:---|:---|:---|
56+
|description|String|The descriptive text for the item. The maximum length limit is 250 characters. Optional. Inherited from [baseSitePage](../resources/basesitepage.md).|
57+
|newsWebUrl|String|The URL of the news article referenced by the **newsLinkPage**. It can be an external link. Required.|
58+
|title|String|Title of the **newsLinkPage**. The maximum length limit is 110 characters. Required. Inherited from [baseSitePage](../resources/basesitepage.md).|
59+
60+
## Response
61+
62+
If successful, this method returns a `201 Created` response code and a [newsLinkPage](../resources/newslinkpage.md) object in the response body.
63+
64+
## Examples
65+
66+
### Example 1: Create a news link page with only the required properties
67+
68+
The following example shows how to create a [news link page](../resources/newslinkpage.md) using only the required properties.
69+
70+
#### Request
71+
The following example shows a request.
72+
73+
<!-- { "blockType": "request", "name": "create-newslinkpage", "scopes": "sites.readwrite.all" } -->
74+
```
75+
POST /sites/c1370818-f5e0-4a40-a99b-be4520640642/pages
76+
prefer: include-unknown-enum-members
77+
Content-Type: application/json
78+
79+
{
80+
"@odata.type": "#microsoft.graph.newsLinkPage",
81+
"newsWebUrl":"https://someexternalnewssite.com/2024/11/11/contoso-unveils-first-self-driving-car",
82+
"title": "Contoso Unveils First Self-Driving Car"
83+
}
84+
```
85+
86+
#### Response
87+
88+
The following example shows the response.
89+
90+
<!-- {
91+
"blockType": "response",
92+
"truncated": true,
93+
"@odata.type": "microsoft.graph.newsLinkPage"
94+
}
95+
-->
96+
```http
97+
HTTP/1.1 201 Created
98+
Content-type: application/json
99+
100+
{
101+
"eTag": "\"{6A34958A-6F84-4571-A26E-B2CEB20261EB},3\"",
102+
"id": "6a34958a-6f84-4571-a26e-b2ceb20261eb",
103+
"lastModifiedDateTime": "2023-09-10T18:46:23Z",
104+
"name": "contoso-unveils-first-self-driving-car.aspx",
105+
"webUrl": "https://contoso.sharepoint.com/SitePages/contoso-unveils-first-self-driving-car.aspx",
106+
"title": "Contoso Unveils First Self-Driving Car",
107+
"pageLayout": "newsLink",
108+
"newsWebUrl": "https://someexternalnewssite.com/2024/11/11/contoso-unveils-first-self-driving-car",
109+
"createdBy": {
110+
"user": {
111+
"displayName": "Jane Doe"
112+
}
113+
},
114+
"lastModifiedBy": {
115+
"user": {
116+
"displayName": "Jane Doe"
117+
}
118+
},
119+
"contentType": {
120+
"id": "0x0101009D1CB255DA76424F860D91F20E6C4118002A50BFCFB7614729B56886FADA02339B000B27C676C81DC54289A1417148759BF3",
121+
"name": "Repost Page"
122+
},
123+
"publishingState": {
124+
"level":"checkout",
125+
"versionId":"0.1",
126+
"checkedOutBy": {
127+
"user": {
128+
"displayName":"Jane Doe",
129+
"email":"JaneDoe@contoso.sharepoint.com"
130+
}
131+
}
132+
}
133+
}
134+
```
135+
136+
### Example 2: Create a news link page and upload the banner image file content
137+
138+
The following example shows how to create a [news link page](../resources/newslinkpage.md) with a banner image. This process requires a multipart request.
139+
140+
#### Request
141+
142+
The following example shows a request.
143+
144+
<!-- {
145+
"blockType": "request",
146+
"name": "create-newslinkpage-multipart",
147+
"scopes": "sites.readwrite.all"
148+
} -->
149+
```http
150+
POST https://graph.microsoft.com/beta/sites/c1370818-f5e0-4a40-a99b-be4520640642/pages
151+
Prefer: include-unknown-enum-members
152+
Content-type: multipart/form-data; boundary=MyPartBoundary198374
153+
154+
--MyPartBoundary198374
155+
Content-Disposition: form-data; name="request"
156+
Content-Type: application/json
157+
158+
{
159+
"@odata.type": "#microsoft.graph.newsLinkPage",
160+
"title": "Microsoft Build brings AI tools to the forefront for developers",
161+
"newsWebUrl": "https://someexternalnewssite.com/2024/05/23/microsoft-build-ai-tools-developers",
162+
"description": "You only need two simple letters to accurately convey the major shift in the technology space this year: A and I. Beyond those letters, however, is a complex, evolving and exciting way in which we work, communicate and collaborate.",
163+
"@microsoft.graph.bannerImageWebUrlContent": "name:content"
164+
}
165+
166+
--MyPartBoundary198374
167+
Content-Disposition: form-data; name="content"; filename="b3.jpg"
168+
Content-Type: image/jpeg
169+
170+
... binary image data ...
171+
172+
--MyPartBoundary198374
173+
```
174+
175+
#### Response
176+
177+
The following example shows the response. If a failure occurs when you upload or persist the banner image, the response contains `@microsoft.graph.bannerImageWebUrlContentError` and a descriptive error message.
178+
179+
>**Note:** The response object shown here might be shortened for readability.
180+
181+
<!-- {
182+
"blockType": "response",
183+
"truncated": true,
184+
"@odata.type": "microsoft.graph.newsLinkPage"
185+
}
186+
-->
187+
```http
188+
HTTP/1.1 201 Created
189+
Content-Type: application/json
190+
191+
{
192+
"@odata.type": "#microsoft.graph.newsLinkPage",
193+
"createdDateTime": "2024-06-11T17:31:20Z",
194+
"description": "You only need two simple letters to accurately convey the major shift in the technology space this year: A and I. Beyond those letters, however, is a complex, evolving and exciting way in which we work, communicate and collaborate.",
195+
"eTag": "\"{179210C2-637E-4C61-8491-331D0D4A0C05},2\"",
196+
"id": "179210c2-637e-4c61-8491-331d0d4a0c05",
197+
"lastModifiedDateTime": "2024-06-11T17:31:21Z",
198+
"name": "microsoft-build-ai-tools-developers.aspx",
199+
"webUrl": "https://contoso.sharepoint.com/SitePages/Microsoft-Build-brings-AI-tools-to-the-forefront-for-developers.aspx",
200+
"title": "Microsoft Build brings AI tools to the forefront for developers",
201+
"pageLayout": "newsLink",
202+
"bannerImageWebUrl": "https://contoso.sharepoint.com/_layouts/15/getpreview.ashx?path=/SiteAssets/SitePages/microsoft-build-ai-tools-developers/BannerImage.png",
203+
"newsWebUrl": "https://someexternalnewssite.com/2024/05/23/microsoft-build-ai-tools-developers",
204+
"createdBy": {
205+
"user": {
206+
"displayName": "John Doe",
207+
"email": "jdoe@contoso.com"
208+
}
209+
},
210+
"lastModifiedBy": {
211+
"user": {
212+
"displayName": "John Doe",
213+
"email": "jdoe@contoso.com"
214+
}
215+
},
216+
"publishingState": {
217+
"level": "checkout",
218+
"versionId": "0.1",
219+
"checkedOutBy": {
220+
"user": {
221+
"displayName": "John Doe",
222+
"email": "jdoe@contoso.com"
223+
}
224+
}
225+
}
226+
}
227+
```
228+
229+
<!--
230+
{
231+
"type": "#page.annotation",
232+
"description": "Create newsLinkPage",
233+
"keywords": "",
234+
"section": "documentation",
235+
"tocPath": "",
236+
"suppressions": [
237+
"Error: /api/newslinkpage-create.md/create-newslinkpage:
238+
Error parsing resource definition: Unexpected character encountered while parsing number: M. Path '', line 1, position 2.",
239+
"Error: /api/newslinkpage-create.md/create-newslinkpage-multipart:
240+
Error parsing resource definition: Unexpected character encountered while parsing number: M. Path '', line 1, position 2.",
241+
"Error: /api/newslinkpage-create.md/create-newslinkpage:
242+
Error parsing resource definition: Unexpected character encountered while parsing number: M. Path '', line 1, position 2."
243+
]
244+
}
245+
-->
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
title: "Get newsLinkPage"
3+
description: "Get the metadata of a newsLinkPage in the site pages list of a site."
4+
author: "shgangan"
5+
ms.date: 04/01/2024
6+
ms.localizationpriority: "medium"
7+
ms.subservice: "sharepoint"
8+
doc_type: "apiPageType"
9+
---
10+
11+
# Get newsLinkPage
12+
13+
Namespace: microsoft.graph
14+
15+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
16+
17+
Get the metadata of a [newsLinkPage](../resources/newslinkpage.md) in the site pages [list](../resources/list.md) of a [site](../resources/site.md).
18+
19+
## Permissions
20+
21+
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](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
22+
23+
<!-- {
24+
"blockType": "permissions",
25+
"name": "newslinkpage_get"
26+
}
27+
-->
28+
[!INCLUDE [permissions-table](../includes/permissions/newslinkpage-get-permissions.md)]
29+
30+
## HTTP request
31+
32+
<!-- {
33+
"blockType": "ignored"
34+
}
35+
-->
36+
``` http
37+
GET /sites/{site-id}/pages/{page-id}/microsoft.graph.newsLinkPage
38+
```
39+
40+
## Optional query parameters
41+
42+
This method supports the `$count`, `$expand`, `$filter`, `$orderby`, `$select`, and `$top` [OData query parameters](/graph/query-parameters) to help customize the response.
43+
44+
## Request headers
45+
46+
|Name|Description|
47+
|:---|:---|
48+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
49+
50+
## Request body
51+
52+
Don't supply a request body for this method.
53+
54+
## Response
55+
56+
If successful, this method returns a `200 OK` response code and a [newsLinkPage](../resources/newslinkpage.md) object in the response body.
57+
58+
## Examples
59+
60+
### Request
61+
62+
The following example shows a request.
63+
64+
<!--{
65+
"blockType": "request",
66+
"name": "get-newslinkpage",
67+
"scopes": "sites.read.all"
68+
}
69+
-->
70+
71+
```http
72+
GET https://graph.microsoft.com/beta/sites/c1370818-f5e0-4a40-a99b-be4520640642/pages/637c601e-0d0e-43c0-b50f-b18513bb9de2/microsoft.graph.newsLinkPage
73+
```
74+
75+
### Response
76+
77+
The following example shows the response.
78+
>**Note:** The response object shown here might be shortened for readability.
79+
80+
<!-- {
81+
"blockType": "response",
82+
"truncated": true,
83+
"@odata.type": "microsoft.graph.newsLinkPage"
84+
}
85+
-->
86+
87+
``` http
88+
HTTP/1.1 200 OK
89+
Content-Type: application/json
90+
91+
{
92+
"@odata.type": "#microsoft.graph.newsLinkPage",
93+
"createdDateTime": "2024-06-11T17:31:20Z",
94+
"description": "You only need two simple letters to accurately convey the major shift in the technology space this year: A and I. Beyond those letters, however, is a complex, evolving and exciting way in which we work, communicate and collaborate.",
95+
"eTag": "\"{179210C2-637E-4C61-8491-331D0D4A0C05},2\"",
96+
"id": "179210c2-637e-4c61-8491-331d0d4a0c05",
97+
"lastModifiedDateTime": "2024-06-11T17:31:21Z",
98+
"name": "microsoft-build-ai-tools-developers.aspx",
99+
"webUrl": "https://contoso.sharepoint.com/SitePages/Microsoft-Build-brings-AI-tools-to-the-forefront-for-developers.aspx",
100+
"title": "Microsoft Build brings AI tools to the forefront for developers",
101+
"pageLayout": "newsLink",
102+
"bannerImageWebUrl": "https://contoso.sharepoint.com/_layouts/15/getpreview.ashx?path=/SiteAssets/SitePages/microsoft-build-ai-tools-developers/BannerImage.png",
103+
"newsWebUrl": "https://someexternalnewssite.com/2024/05/23/microsoft-build-ai-tools-developers",
104+
"createdBy": {
105+
"user": {
106+
"displayName": "John Doe",
107+
"email": "jdoe@contoso.com"
108+
}
109+
},
110+
"lastModifiedBy": {
111+
"user": {
112+
"displayName": "John Doe",
113+
"email": "jdoe@contoso.com"
114+
}
115+
},
116+
"publishingState": {
117+
"level": "published",
118+
"versionId": "1.0"
119+
}
120+
}
121+
```
122+
123+
<!--
124+
{
125+
"type": "#page.annotation",
126+
"description": "Get a newslinkpage in a site",
127+
"keywords": "",
128+
"section": "documentation",
129+
"tocPath": "Pages/Get",
130+
"suppressions": [
131+
]
132+
}
133+
-->

0 commit comments

Comments
 (0)