The class is ActivityPreference. ActivityManager class accepts userprofile object but it has to match the current user (see this). If not it seems to retrive from httpcontext or windows identity. Also it looks like it cannot be impersonated with system account. To update the propety under user context use something like below.
string siteUrl = "http://site/";
string managerType = "ManagerChange";
using (SPSite site = new SPSite(siteUrl))
{
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
UserProfile profile = profileManager.GetUserProfile("domain\\username");
ActivityManager activityManager = new ActivityManager(profile, serviceContext);
List<ActivityPreferencePerType> apptc = new List<ActivityPreferencePerType>();
foreach (ActivityType type in activityManager.ActivityTypes)
{
ActivityPreferencePerType appt = new ActivityPreferencePerType();
appt.ActivityType = type;
appt.IsSet = false;
if (type.ActivityTypeName.ToLower() == managerType.ToLower())
{
appt.IsSet = false;
}
else
{
appt.IsSet = true;
}
apptc.Add(appt);
}
ActivityPreferencesCollection coll = activityManager.ActivityPreferences;
coll.SetActivityPreferencesPerType(apptc);
coll.Commit();
coll.Refresh();
In PowerShell (using reflection to set preference for another user).
[void] [System.Reflection.Assembly]::LoadWithPartialName("System")
$loginname = "domain\testuser"
$site = Get-SPSite "http://site"
$context = Get-SPServiceContext $site;
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context);
#$myprofile = $upm.GetUserProfile("domain\myusername")
$profile1 = $upm.GetUserProfile([string]$loginname)
$am = New-Object Microsoft.Office.Server.ActivityFeed.ActivityManager($myprofile1, $context)
$type = $am.GetType()
$methodInfo = $type.GetMethod("CopyBasicUserInfo", [reflection.bindingflags]"nonpublic,instance", $null, $profile1.GetType(), $null)
$methodInfo.Invoke($am, $profile1)
$apptList = New-Object System.Collections.Generic.List[Microsoft.Office.Server.ActivityFeed.ActivityPreferencePerType]
$am.ActivityApplications["UserProfileChange_Gatherer"].ActivityTypes | ForEach-Object {
$appt = New-Object Microsoft.Office.Server.ActivityFeed.ActivityPreferencePerType
$appt.ActivityType = $_
if($_.ActivityTypeName -eq "ManagerChange") {
$appt.IsSet = $false
}
else {
$appt.IsSet = $true
}
$apptList.Add($appt)
}
$am.ActivityPreferences.SetActivityPreferencesPerType($apptList)
$am.ActivityPreferences.Commit()
$am.ActivityPreferences.Refresh()
This blog talks about it in more detail.