Thursday, 11 January 2018

Promote a Page in SharePoint Communication site



I was playing with the new communication site lately and I was wondering what differs a news page from a normal site page. All of the pages resides under the same site pages library. The first though entered my head was maybe it's a different content type.

By running a simple PowerShell script I find out that they are both using the same Content Type (SitePage) with ID



I was actually shocked as it was an old practice of mine to create different content type for different content elements also separate layout pages to dictate the rendering of these various intranet contents.
What I see now is an editing based experience. You can have various layouts per single content type as you can have a news page with single column layout or two-column layout that enables you to create a specific experience per item not per content type which is very flexible yet more time consuming from and editing experience and requires more governance to make sure that not every news item will have a completely different experience.

The last drawback can be handled by copying an existing post instead of starting from scratch but again that doesn't stop the super user from messing up the copy.

I know I've got side tracked as usual , back to the main topic of the post, what I did next is that I used my poor PowerShell skills to extract all the attributes of the pages then I compared both using winmerge (pretty old tool right)



I find out that there is a property called PromotedState which is 0 in the case of normal SitePage and 2 in the news Page.

If you navigate to a normal site Page you will find an option to promote a page which gives you an option to publish it as news post (eventually change the PromoteState from 0 to 2), you can only see the promote button if the page is published

to figure out what really happens behind the scene I had to look for all the xhr request in the browser console and I find out that when you click promote button it sends a POST request to https://yourtenant.sharepoint.com/sites/sitename/_api/sitepages/pages(10)/PromoteToNews

and the response returns as below indicating a successful promotion of the page

Then the page PromoteState will be updated to 2 and will appear in the Out of the box news webpart