我可以连接到本地Sharepoint,但所有Get-Commands都返回错误403



我执行以下操作:

$url = 'https://oo.de/websites/it'
$sncred = Get-StoredCredential -Target PnPPS:SPCredentials
$Global:snPnPConn = Connect-PnPOnline -Url $url -Credentials $sncred -TransformationOnPrem -CurrentCredential -ReturnConnection 
# Does run, but the next one gives 403-Error
Get-PnpList
Get-PnPList : Der Remoteserver hat einen Fehler zurückgegeben: (403) Unzulässig.

如何调试?根据我的网站管理员的说法,我对该网站拥有完全的访问权限。我可以在浏览器中打开网站。Internet上的所有帮助都指向AzureAD(?!(。

$snPnpConn:
>ConnectionType                         : O365
>InitializationType                     : Unknown
>Scopes                                 :
>PSCredential                           :
>ClientId                               : 31359c7f-bd7e-475c-86db-fdb8c937548e
>ClientSecret                           :
>ApplicationInsights                    : PnP.PowerShell.ALC.ApplicationInsights
>Url                                    : https://foo.de/websites/it
>TenantAdminUrl                         :
>Certificate                            :
>DeleteCertificateFromCacheOnDisconnect : False
>Context                                : PnP.Framework.PnPClientContext
>Tenant                                 :
>AzureEnvironment                       : Production

我遇到了同样的问题。我的解决方案是卸载PnP.PowerShell模块并安装旧的SharePointPnPPowerShell2019模块。旧模块没有得到维护,但新版本不支持内部安装。对此存在一些困惑,并且有人试图让PnP.PowerShell在prem上使用(-TransformationOnPrem标志(。但截至2022年5月的微软文档称,PnP.PowerShell不支持内部部署场:PnP PowerShell。

从PowerShell运行";卸载模块PnP.PowerShell";。一旦完成;安装模块SharePointPnPPowerShell2019";(或2016年或2013年,具体取决于您的SharePoint版本。

在安装了遗留模块后,我能够成功地运行Get-PnPList等命令,而不会出现403个错误。

对于所有需要此连接模式将页面转换为现代页面的人,您必须使用PowerShell 7.0+。然后Connect PnPOnline(PnP.PowerShell(可以在本地连接到SharePoint。

最新更新