Introduction
When we are doing a SharePoint deployment using PowerShell there we could find similar problem like that:
Cannot convert the “Microsoft.SharePoint.Client.ClientContext” value of type “Microsoft.SharePoint.Client.ClientContext” to type “Microsoft.SharePoint.Client.ClientRuntimeContext”.”
Problem
In my scenario I was trying to Activate a Sandboxed solution using PowerShell:
1 | $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl); |
And I received the error mentioned before. I did some checks:
- Run as administrator
- Run using SharePoint Online PowerShell command line.
- Check I have installed Client Components.
Solution
But after some investigations, the reason is the version of SharePoint Client Components and SharePoint Online Management Shell I was using.
To solve it, Install latest version of them, uninstall previous versions and restart Powershell console.
All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.