shravan mj

shravan mj

  • NA
  • 32
  • 5.6k

Not able to unfollow followed sites in mysite

Feb 10 2017 3:35 PM
Hi Geeks,
 
I have SP 2013 on prem and stuck with an issue. I have an user who had followed sites when the site url was http. Now SSL is configured and all sites start with Https url. Problem is user is not able to unfollow these sites and when I found the logs Could not stop following the item https://------.com/sites/xxxx: Exception: ItemDoesNotExist : Item does not exist
 
I tried to ran the below powershell script but no success
 

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

}

$siteUrl = "https://xx/applications/Test"

$userName = "contosso\admin"

# Load site and user profile service

$site = Get-SPWeb $siteUrl

$serviceContext = Get-SPServiceContext($site.site)

$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)

if ($profileManager.UserExists($userName)) {

# Load user profile

$userProfile = $profileManager.GetUserProfile($userName)

# Load social following manager

$followingManager = New-Object Microsoft.Office.Server.Social.SPSocialFollowingManager($userProfile, $serviceContext)

# Prepare following object

$actorInfo = New-Object Microsoft.Office.Server.Social.SPSocialActorInfo

$actorInfo.ContentUri = $site.Url

$actorInfo.AccountName = $userProfile.AccountName

$actorInfo.ActorType = "Site"

# Add to followed sites

$followingManager.StopFollowing($actorInfo)

}

 Could you help me what else can be done.
 
 Thanks in advance
 
Regards,
SHravan  
 
 
 
 

Answers (2)