Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Connect PnPOnline:在Visual Studio代码中使用时未找到该方法,在Powershell中工作正常_Powershell_Sharepoint - Fatal编程技术网

Connect PnPOnline:在Visual Studio代码中使用时未找到该方法,在Powershell中工作正常

Connect PnPOnline:在Visual Studio代码中使用时未找到该方法,在Powershell中工作正常,powershell,sharepoint,Powershell,Sharepoint,我目前正在编写可以在Azure函数中部署的PowerShell代码,该代码创建了一个新的SharePoint站点。我在Visual Studio代码中工作 在PowerShell中手动执行时,一切正常,但有些命令在代码中似乎不起作用新PnPSite抛出: 例外:没有连接,请先用connect PnPOnline连接 此异常完全有道理,但当我在使用“New PnPSite”之前使用“Connect PnPOnline”时,我得到: 错误:未找到Connect PnPOnline:方法: 'Syst

我目前正在编写可以在Azure函数中部署的PowerShell代码,该代码创建了一个新的SharePoint站点。我在Visual Studio代码中工作

在PowerShell中手动执行时,一切正常,但有些命令在代码中似乎不起作用<代码>新PnPSite抛出:

例外:没有连接,请先用connect PnPOnline连接

此异常完全有道理,但当我在使用“New PnPSite”之前使用“Connect PnPOnline”时,我得到:

错误:未找到Connect PnPOnline:方法: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String,System.String)“”

我不确定它为什么不工作,因为我的PowerShell和我的Visual Studio代码PowerShell使用同一个模块文件夹。 如何让它在VisualStudio代码中工作


提前谢谢

$env:PSModulePath
路径错误