Update User Profile Feed Identifer after User Profile Re-Creation

The script can be used to re-create the user profile feed identifier property.  If this property is not set the user will not be able to use Social features like newsfeed on my site host.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$MySiteHost = new-object Microsoft.SharePoint.SPSite("https://mysites.contoso.com/");  
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($MySiteHost);  

$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext);  
$profile = $ProfileManager.GetUserProfile("contoso\adamb"); 
$Site = $profile.PersonalSite
$Site | Select *
$Site.RootWeb.Created
#If Personal Site needs to be created.  The feed Identifier will be added automatically in that case.
#$profile.CreatePersonalSite()
$profile.FeedIdentifier
#If My Site Already Exist.
$microFeedId = ($Site.Url + ";1." + $Site.ID.ToString().Replace("-", "") + "." + $Site.RootWeb.ID.ToString().Replace("-", "") + "." + $Site.RootWeb.Lists["Microfeed"].ID.ToString().Replace("-", "") + ".0c37852b34d0418e91c62ac25af4be5b")
$profile["SPS-FeedIdentifier"].Value = $microFeedId
$profile.Commit()
$Site.Dispose()
$MySiteHost.Dispose()
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s