0

am using SPFx framework to create webpart for user feed. I am facing a strange issue. I am calling below url using rest

https://<mysite>/sites/aqltechv/_api/social.feed/my/feed

When I paste same url in browser it is working fine and it is giving me reply count. But If I call in SPFx frame work reply count is coming as zero. Any headers or anything need to modify. If I specify headers like Content-Type or Accept it is giving me error as Accept is not available. So I am not using any headers. I am using in my SPFx framework as below

this.context.spHttpClient.get(feedUrl + '/_api/social.feed/my/feed',
      SPHttpClient.configurations.v1
    )
      .then((response: SPHttpClientResponse) => {


        response.json().then(data => {          
          data.SocialFeed.Threads.forEach(element => {
            if(element["PostReference"]!=null){

              console.log(element);
            }
          });
        })
      })

Anything wrong in above code?

Note: In browser only single thread is coming. But in SPFx framework it is showing as 5 threads. Actually I am having only single thread in my feed.

  • you are using /_api/social.feed/my/news in the browser but in spfx webpart you are using /_api/social.feed/my/feed. – Gautam Sheth Nov 15 '17 at 6:35
  • Sorry typo error. Updated – Mihir Nov 16 '17 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.