[英]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.