[英]Unable to Use SharePoint PNP PowerShell in VSCode
在 VScode 中运行此命令不起作用,但它在 PowerShellPlus 中有效。
Connect-PnPOnline -Url "https://something.sharepoint.com/" -Credentials $userCredential
错误:
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()
我已经尝试卸载 VScode 并删除我的机器上的任何 SharePoint 痕迹,但我无法克服此错误。 有任何想法吗?
编辑:在这篇博文之后,我删除并重新安装了 SP PNP 模块。https://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=802
这是我解决问题的方法:
1. 在 VSCode 中,使用 Ctrl+Shift+P 打开 Windows 或 Linux 上的命令面板。 在 macOS 上,使用 Cmd+Shift+P。
2. 搜索会话。
3. 单击 PowerShell:显示会话菜单。
4. 选择___ (x86)选项之一
我使用的是 x64,这显然不起作用。
请不要在您的机器中 uninatll 的 SharePoint 跟踪,并确保您已安装相应的 PnP PowerShell 库:
然后在 VSCode 中,请安装 PowerShell 插件:
打开保存 PnP PowerShell 代码的 .ps1 并按 F5 运行和调试:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.