Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用powershell更改sharepoint 2010中所有用户的用户配置文件属性_Powershell_Sharepoint 2010 - Fatal编程技术网

使用powershell更改sharepoint 2010中所有用户的用户配置文件属性

使用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

我想为所有用户更改名为Department的用户配置文件属性的编辑设置和显示设置值。有人能告诉我怎么做吗

我可以用这个powershell去部门。现在,此属性编辑设置为“不允许用户编辑此属性”,我想让每个用户都可以编辑此属性

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()
参考资料