News article page comments

Frequent Contributor



I am currently working on a project using the SharePoint Framework. I'm looking for a way to get the comments made by users on a page. The pages are news articles, and I am able to get info like Author, ImageURL, ViewCount and so on. Where are the comments stored, and is there a way to get the number of comments made on a news article?







7 Replies
best response confirmed by Maggan Wåhlin (Frequent Contributor)
The comments are not stored in SPO itself...take a look at this:

Thank you @Juan Carlos González Martín, that helped a lot!

Glad to help!

How did you get the ViewCount?


@Magnus Forsmark, I got it from the JSON response object. I am somewhat a beginner at SPFx, so I am not 100% sure this is the correct approach, but here´s an example:


private getNews(url: string) : Promise<any> {
    return this.context.spHttpClient.get(url, SPHttpClient.configurations.v1).then((response: SPHttpClientResponse) => {
      if (response.ok) {
        return response.json();
      } else {
        console.log("WARNING - failed to hit URL " + url + ". Error = " + response.statusText);
        return null;

  private getNewsItems(): Promise<NewsItem[]> {
    // URL to get news
    var url = this.context.pageContext.web.absoluteUrl + `/_vti_bin/homeapi.ashx/news?start=0&count=200`;

    return this.getNews(url).then((response) => {
        var news: Array<NewsItem> = new Array<NewsItem>();

        response.Items.forEach((item: any) => {     
              var newsItem = new NewsItem();
              newsItem.Title = item.Title;                
              newsItem.Published = item.FirstPublishedDate;
              newsItem.Author = item.Author.Title;
              newsItem.URL = item.Url;  
              newsItem.Text = item.Description;   
              newsItem.ImageUrl = item.ImageUrl;
              newsItem.LastModifiedBy = item.LastModifiedBy;
              newsItem.ViewCount = item.ViewCount == null ? 0 : item.ViewCount;

        return news;


Thanks! That worked!

Glad to help :)