SharePoint / SharePoint/sp-dev-docs

SocialFollowingManager.StopFollowing is not working

Open
#10,159 7 comments 0 reactions 1 assignee View on GitHub

@Amey-MSFT is already working on this.

Since Mar 18, 2025.

area:spfx sharepoint-developer-support type:bug-confirmed
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details
  • SPFx version 1.20
Describe the bug / error

It worked a couple of months back but now the same code runs (no error) but the user remains followed.
I have tried both using pnp.js "
const unfollowResult = await this.sp.social.stopFollowing(userInfo);
and using direct api access:
const restApiUrl = ${this.context.pageContext.web.absoluteUrl}/_api/social.following/my/stopfollowing;

Passing the same actorinfo to both calls.

I have verified the user is being followed, and the pnp.js code does correctly retrieve the user as a followed user in sp.social.my.followed calls.
not sure when it stopped working - have not tested this feature in a few months.

The stopFollowing is returning an object with null value :
{
"odata.metadata": "https://[tenant]sites/testsite/_api/$metadata#Edm.Null",
"odata.null": true
}

the api call returns response status of 204 (no response body). According to documentation it should be true or false (is user still being followed)

Steps to reproduce
  1. create spfx webpart that calls sp.social.my.followed and shows the user a button for each to call the stopFollowing
  2. click the button - refresh the page - the user is still being followed.3.
Expected behavior

a call to either the pnp or the api should remove the user from the followed list.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.