在 SharePoint 2010 MySite EditProfile.aspx 上,有电子邮件通知的设置:
[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.
不幸的是,他们默认选中所有三个选项。我想为所有用户(现在和将来)设置不同的默认值,并让他们明确选择加入这些选项。
有什么办法吗?仅执行 SQL UPDATE 将属性 5040 设置为 7 的想法失败了,因为该属性在数据库中默认不存在,并且如果 SharePoint 在数据库中找不到它,则默认为 0(=全部选中)。
答案1
我遇到了类似的问题,并找到了一个简洁的 PowerShell 命令,看起来可以解决问题这里。下面是博客文章中的代码,只需删除注释并运行即可。
我在测试环境中这样做了,虽然出现了一些小错误,但效果很好!唯一的问题是,新用户会默认启用它,这很令人沮丧:
#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();