0

On the SharePoint 2010 MySite EditProfile.aspx, there are settings for Email Notifications:

[x] Notify me when someone leaves a note on my profile.
[x] Notify me when someone adds me as a colleague.
[x] Send me suggestions for new colleagues and keywords.

Select which e-mail notifications you want to receive. 

Unfortunately, they default to having all three options checked. I would like to set different defaults for all users, present and future and have them explicitly Opt in to these.

Is there any way to do that? The idea of just executing a SQL UPDATE to set Property 5040 to 7 fails because that property doesn't exist by default in the database, and if SharePoint can't find it in the database it defaults to 0 (=all checked).

Michael Stum
  • 4,050
  • 4
  • 36
  • 50

1 Answers1

1

I had a similar issue and found a neat PowerShell command that looks like it does the trick here. Below is the code from the blog article, just remove the comments and run.

I did it in my test environment and there were a few minor errors but worked like a charm! Only thing is, new users will have it enabled by default which is a bummer:

#Load the SharePoint snap-in
Add-PsSnapin Microsoft.SharePoint.PowerShell;

#Load the SharePoint assemblies
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server");
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles");

#Specify the MySite URL
$MySiteUrl = "http://sharepoint.yoursite.com/";

#Get the server context for the profile manager
$site = Get-SPSite $MySiteUrl;
$ServerContext = Get-SPServiceContext $site;
$UPManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServerContext);

#Count variables
$ucount = 0;

$enumProfiles = $UPManager.GetEnumerator();
"Total User Profiles available:" + $UPManager.Count
$count=0;

#Loop through the profile entries and update the property
#Recieve Instant Notifications - NGAllowMetaEmail (bool)
#24 Hour Digest Email - NGReceiveDigestEmail (bool)
#RSS NewsFeed Email - NGAllowRssEmail (bool)
#SharePoint Notification emails - SPS-EmailOptin (int)
#This field has 3 values one for each email type

foreach ($oUser in $enumProfiles)
{
    $count = $count + 1;
    $u = $oUser.Item("Accountname");
    Write-Output "($count):  Setting values for $u";

    $oUser["NGAllowMetaEmail"].Value = $false;
    $oUser["NGReceiveDigestEmail"].Value = $false;
    $oUser["NGAllowRssEmail"].Value = $false;
    $oUser["SPS-EmailOptin"].Value = 111; 

    $oUser.Commit();
} 

#Dispose of site object
$site.Dispose();
James
  • 11
  • 1