question

Olivier-5594 avatar image
0 Votes"
Olivier-5594 asked Olivier-5594 commented

How to make a news post with SharePoint Online API?

I was wondering if it was possible to post a news with the SharePoint API as I did with a News link.

For a news link I used as endpoint https://mysite.sharepoint.com/sites/News/_api/SitePages/pages/reposts but I didn't find the endpoint for news post.

My HTTP body looks like that:

 {
 "__metadata": {
     "type": "SP.Publishing.RepostPage"
 },
     "BannerImageUrl": null,
     "Description":"Description",
     "IsBannerImageUrlExternal":true,
     "OriginalSourceUrl":"https://docs.microsoft.com",
     "ShouldSaveAsDraft":false,
     "Title":"My title"
 }

Thanks for our help

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered Olivier-5594 commented

Hi @Olivier-5594,

As far as I know, there seems no such REST API can post News currently in SharePoint. The same question was asked here: https://social.technet.microsoft.com/Forums/msonline/en-US/b65f0544-2043-43f7-a920-2427cdce04c6/how-to-post-news-in-sharepoint-modern-site-using-sharepoint-rest-api?forum=onlineservicessharepoint

As a workaround, you could creat a news post through UI and save it as template. Templates are saved in the Templates folder in the Site Pages library. Then we can use the below api to create page from the template:

 /_api/web/GetFileByServerRelativePath('/sites/Site Name/SitePages/Templates/Page-Filename.aspx')/copyTo('/sites/Site Name/SitePages/New-Page-Filename.aspx')



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for your answer Michael.

0 Votes 0 ·