Skip to main content

Posts

Showing posts from March, 2012

SharePoint MySite – PowerShell script to get the “Activities I am following” preferences

 So I was asked to collect the preferences of “Activities I am following” (image below) for all the users of our SP2010 My Site. The resources on web for this being  surprisingly limited , I was left with no other option but to turn to my cup of coffee  for solution . The coffees helped, the following script lists out the status of options available under “Activities I am following ” of My Site Edit Profile page in SharePoint 2010 , for each user. $mySiteURL = "https://xxxx" $site = Get-SPSite $mySiteURL $context = Get-SPServiceContext $site; $upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context); $val = "Username,ActivityName,Value" Add-content -path "d:activity_preference.txt" -value $val foreach ($profileupm in $upm.GetEnumerator()) { $myprofile = $profileupm; $usrprofile = $profileupm; $am = New-Object Microsoft.Office.Server.ActivityFeed.ActivityManager($myprofile, $context) $type = $am.GetType() $methodIn