使用powershell更改sharepoint 2010中所有用户的用户配置文件属性
我想为所有用户更改名为Department的用户配置文件属性的编辑设置和显示设置值。有人能告诉我怎么做吗 我可以用这个powershell去部门。现在,此属性编辑设置为“不允许用户编辑此属性”,我想让每个用户都可以编辑此属性使用powershell更改sharepoint 2010中所有用户的用户配置文件属性,powershell,sharepoint-2010,Powershell,Sharepoint 2010,我想为所有用户更改名为Department的用户配置文件属性的编辑设置和显示设置值。有人能告诉我怎么做吗 我可以用这个powershell去部门。现在,此属性编辑设置为“不允许用户编辑此属性”,我想让每个用户都可以编辑此属性 Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue $mySiteUrl = "http://www.test.com/mysite" $site = Get-SPSite
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
$mySiteUrl = "http://www.test.com/mysite"
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$userProfile = $profileManager.GetUserProfile("Test\822");
$userProfile.Properties | sort DisplayName | FT DisplayName,Name,@{Label="Type";Expression={$_.CoreProperty.Type}}
$userProfile["Department"].Value
$site.Dispose()
谢谢,我想你是说这房子吧 下面的脚本演示如何设置
IsUserEditable
部门的子属性用户配置文件属性:
if ((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null)
{
Add-PsSnapin Microsoft.SharePoint.PowerShell
}
$siteUrl = "http://contoso.intranet.com/"
$site = Get-SPSite $siteUrl
$context = Get-SPServiceContext($site)
$profileConfigMgr = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context)
$profilePropMgr = $profileConfigMgr.ProfilePropertyManager
$subtypePropMgr = $profilePropMgr.GetProfileSubtypeProperties("UserProfile")
$subtypeProp = $subtypePropMgr.GetPropertyByName("Department")
$subtypeProp.IsUserEditable = $true
$subtypeProp.Commit()
参考资料