Forum Discussion

Hansjörg Stewering's avatar
Hansjörg Stewering
Brass Contributor
Oct 02, 2017

Access "News from Sites" programmatically

I would like to reuse the "News from Sites" news aggregation from the SharePoint Homepage in my own site collection. Is there a way to programmatically get all news from SharePoint sites that the current user is following?

3 Replies

  • Jon Miller's avatar
    Jon Miller
    Copper Contributor
    Actually, if you google 'PromotedState' you come up with this page from Elio Struyf who does a far more detailed explanation of this. https://www.eliostruyf.com/what-makes-a-page-to-be-a-news-page-on-sharepoint-online/
  • Jon Miller's avatar
    Jon Miller
    Copper Contributor
    I found that there is a crawled property ("PromotedState") which you can then map in search schema to a Refinable property. Then you can just use this in Content by Search web parts. The 'News from Sites' content type has a value of '2' in the PromotedState property, so you can filter your search results to that and return all news pages. Hope that helps.
    • Hansjörg Stewering's avatar
      Hansjörg Stewering
      Brass Contributor

      Excellent, thank you. 

      Is there any way to use a content by search in modern site pages?