Forum Discussion

Maggan Wåhlin's avatar
Maggan Wåhlin
Iron Contributor
Nov 23, 2017

Enable Likes in modern page comments

I´m working on an SPFx web part to show aggregated comments made within a site. I am able to get all info about a comment through REST:

 

https://xxx.sharepoint.com/sites/vmf-lab/_api/web/lists('${this.properties.pagelibraryid}')/GetItemById(${page.Id})/comments?$select=createdDate,text,replycount,likeCount,author/name&$expand=author

I want to display the likeCount for a comment, but it does not seem to be possible to like a comment on a modern page, only reply to it... Or am I missing something..?

 

 

3 Replies

  • HI Maggan Wåhlin,

     

    I think that liking comments might be something that is on its way. If you open the site with SharePoint Designer then you will see that there is a hidden list with a name like: Comments<GUID>

     

    Within this list there is a set of fields related to likes. 

     

    To answer you question, I don't think that you can like any comments at the moment.

    • Maggan Wåhlin's avatar
      Maggan Wåhlin
      Iron Contributor

      Thank you Pieter Veenstra.

       

      I just pasted the REST-call above in Postman to get all comment properties. Works fine. Just surprising that there is a property named likeCount, when it isn´t possible to like a comment :-)

       

      <?xml version="1.0" encoding="utf-8"?>
      <feed xml:base="https://xxx.sharepoint.com/sites/lab/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
          <id>8bef73cd-dfcc-40e4-938a-2f1b763b6ff8</id>
          <title />
          <updated>2017-11-23T13:22:58Z</updated>
          <entry>
              <id>https://xxx.sharepoint.com/sites/lab/_api/web/lists('6c0a16c3-c8d8-47ce-81f5-ba7893d00d0c')/GetItemById(33)/Comments(2)</id>
              <category term="Microsoft.SharePoint.Comments.comment" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
              <link rel="edit" href="https://xxx.sharepoint.com/sites/lab/_api/web/lists('6c0a16c3-c8d8-47ce-81f5-ba7893d00d0c')/GetItemById(33)/Comments(2)" />
              <title />
              <updated>2017-11-23T13:22:58Z</updated>
              <author>
                  <name />
              </author>
              <content type="application/xml">
                  <m:properties>
                      <d:author m:type="SP.Sharing.Principal">
                          <d:email>Maggan.Wahlin@teknikhuset.se</d:email>
                          <d:id m:type="Edm.Int32">68</d:id>
                          <d:isActive m:type="Edm.Boolean">true</d:isActive>
                          <d:isExternal m:type="Edm.Boolean">false</d:isExternal>
                          <d:jobTitle m:null="true" />
                          <d:loginName>i:0#.f|membership|mawah@teknikhuset.se</d:loginName>
                          <d:name>Maggan Wåhlin</d:name>
                          <d:principalType m:type="Edm.Int32">1</d:principalType>
                          <d:userId m:null="true" />
                      </d:author>
                      <d:createdDate m:type="Edm.DateTime">2017-11-22T09:02:48Z</d:createdDate>
                      <d:likeCount m:type="Edm.Int32">0</d:likeCount>
                      <d:replyCount m:type="Edm.Int32">1</d:replyCount>
                      <d:text>Trying out the comment-function</d:text>
                  </m:properties>
              </content>
          </entry>
      </feed>

      Well, I guess good things happen to those who wait :-)

       

       

       

      • Pieter Veenstra's avatar
        Pieter Veenstra
        MVP

        indeed, I found the same when I tried the REST call. The likeCount is always set to 0 and the interface doesn't have an option to change it.

         

        I wonder if it is possible to update the likeCount through the API.

Resources