开发者

I wanted to create a user profile in sharepoint using powershell scripting

开发者 https://www.devze.com 2022-12-19 09:56 出处:网络
I have used the below code for fetching the user profile from sharepoint 2010.Error I am getting is object $cm is returning as null.

I have used the below code for fetching the user profile from sharepoint 2010.Error I am getting is object $cm is returning as null.

$site = Get-SPSite($PortalURL); $servercontext = [Microsoft.Office.Server.ServerContext]::GetContext($site); $site.Dispose();

Return the UserProfileConfigManager

$cm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager($servercontext); $spm = Get-SPProfileManager $siteUrl

Please help me to resolve this.I have开发者_高级运维 checked the user profile service and its up and ruuning.


I think you are disposing the connection before you should. Dispose at the end and you should be good

0

精彩评论

暂无评论...
验证码 换一张
取 消