1

I am creating personal sites using powershell csom.

My issue is on below line

$loader = [Microsoft.SharePoint.Client.UserProfiles.ProfileLoader]::GetProfileLoader($ctx)

I get following error.

$loader = [Microsoft.SharePoint.Client.UserProfiles.ProfileLoader]::GetProfileLoader($ctx)

Cannot convert argument "context", with value:

"Microsoft.SharePoint.Client.ClientContext", for "GetProfileLoader" to type "Microsoft.SharePoint.Client.ClientRuntimeContext": "Cannot convert the "Microsoft.SharePoint.Client.ClientContext" value of type "Microsoft.SharePoint.Client.ClientContext" to type "Microsoft.SharePoint.Client.ClientRuntimeContext"."

3
  • Did you load "Microsoft.SharePoint.Client.UserProfiles"? Also, You must use Windows PowerShell 3.0. If you use SharePoint 2013 Management Shell, the script will fail.
    – 404
    Mar 24, 2015 at 11:31
  • yes userprofile.dll is loaded. I am following this source code gallery.technet.microsoft.com/scriptcenter/… . I am able to get clientcontext so i think powershell version is OK for 2013 online Mar 24, 2015 at 11:38
  • Can you try using LoadWithPartialName syntax for loading dll instead of Add-Type?
    – 404
    Mar 24, 2015 at 11:49

1 Answer 1

2

I was running into the same issues and it turned out I was referencing the wrong DLLs. I was also having issues with CreatePersonalSiteEnqueueBulk not being recognized.

I was referencing the 15 version not the 16 version and also the 16 version I had was out of date. Be sure you are referencing the proper DLL and have the most up to date version. I'm now running 16.0.3104.1200 and these issues went away.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.