Reputation: 236
Running this command in VScode doesn't work but it works in PowerShellPlus.
Connect-PnPOnline -Url "https://something.sharepoint.com/" -Credentials $userCredential
Error:
System.MissingMethodException: Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'.
at SharePointPnP.PowerShell.Commands.Base.ConnectOnline.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
I've tried uninstalling VScode and removing any trace of SharePoint my machine but I'm not able to get past this error. Any ideas?
Edit: Following this blog post, I removed and reinstalled the SP PNP module. https://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=802
Upvotes: 1
Views: 2765
Reputation: 236
Here is how I fixed my issue:
1. In VSCode open the Command Palette on Windows or Linux with Ctrl+Shift+P. On macOS, use Cmd+Shift+P.
2. Search for Session.
3. Click on PowerShell: Show Session Menu.
4. Choose one of the ___ (x86) options
I was using x64 and that clearly didn't work.
Upvotes: 3
Reputation: 3615
Please don't uninatll the SharePoint trace in your machine and make sure you have install the corresponding PnP PowerShell library:
Then in VSCode, please install the PowerShell plugin:
Open the .ps1 which saved PnP PowerShell code and press F5 to run and debug:
Upvotes: 0