Follow and unfollow sites using REST and Graph API - Strange behaviour

Chandani Prajapati 1 Reputation point MVP
2022-04-15T12:28:52.27+00:00

I am using Graph API to follow/unfollow sites for SPFx. But while calling API, I am always getting a successful response but when I check it in particular SharePoint site, It does not reflect the update. Also tried the same thing using REST API but unfortunately, got the same issue.

http://domain.sharepoint.com/_layouts/15/sharepoint.aspx?v=following

e.g. When I am using followedSites endpoint, I am getting 10 followed sites but after following/unfollowing any sites I am getting an updated response in followedSites. while I am checking the particular SharePoint site, it's not reflecting updates over there.

Graph API

I am using the below endpoints,
followedSites - to get all followed sites,
followedSites/add - to follow site
followedSites/remove - to unfollow site

193350-image.png
193369-image.png

REST API

Using below ednpoints,
/_api/social.following/follow - to follow
/_api/social.following/stopfollowing - to stop follow
/_api/social.following/isfollowed - to check is followed or not so based on this can follow/unfollow

193394-image.png
193418-image.png
193419-image.png

Is it default behavior or I am missing something?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,295 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ShivaniRai-MSFT 2,726 Reputation points
    2022-04-19T13:52:25.307+00:00

    Hi @Chandani Prajapati ,

    As per my testing using Graph API, I found out that it takes couple of minutes to get reflected in SharePoint site UI after making Graph call to follow site. You can verify the same at your end.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments