简体   繁体   English

powershell 返回错误:(403) WebException using New-pnpList

[英]powershell returned an error:(403) WebException using New-pnpList

I had my PS script running the other day and created a new list with a single field with no issues.前几天我运行了我的 PS 脚本并创建了一个新列表,其中包含一个没有问题的字段。 Was able to view the list in the Site Contents lib.能够查看站点内容库中的列表。

Today, it's not working.今天,它不工作了。 I tried running the PS code below and then resorted to running the new-pnplist code at the command line...got the same error which is shown below.我尝试运行下面的 PS 代码,然后求助于在命令行运行 new-pnplist 代码......得到了相同的错误,如下所示。

I'm using the Global admin account.我正在使用全局管理员帐户。 Using version 3.13.19 SharePointPNPPowerShellOnline.使用版本 3.13.19 SharePointPNPPowerShellOnline。 Executed the commands from Powershell ISE which is what I did the other day when it worked.执行来自 Powershell ISE 的命令,这是我前几天工作时所做的。 And, I was able to connect successfully using the Connect-sposervice command.而且,我能够使用 Connect-sposervice 命令成功连接。

Error:错误:

new-pnplist -Template GenericList -Title 'TestPNP2'
new-pnplist : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ new-pnplist -Template GenericList -Title $ListName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [New-PnPList], WebException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.NewList

Code:代码:

$TargetListURL="https://<my sharepoint.com>/sites/CKCDemo"
$ListName="TESTPNP2"

Connect-PnPOnline -url $TargetListURL -CurrentCredentials
New-PnPList -Template GenericList -Title $ListName
Add-PnPField -List $ListName -DisplayName "MyTEST" -InternalName "MyTEST" -Type Text -AddToDefaultView
Get-PnPList` 

Make sure you have enough permission to create a list in this site.确保您有足够的权限在此站点中创建列表。 You could try to go to the site directly, check whether you could create a list through ui.你可以尝试go 直接到站点,检查是否可以通过ui创建列表。

Note: A global admin will not automatically have access to individual sites unless explicitly granted.注意:除非明确授予,否则全局管理员不会自动访问各个站点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Invoke-RestMethod:远程服务器返回错误:(403) Forbidden PowerShell - Invoke-RestMethod : The remote server returned an error: (403) Forbidden PowerShell Powershell - Sharepoint 自动文件上传返回“远程服务器返回错误:(403) 禁止。” 错误 - Powershell - Sharepoint Auto file upload returning "The remote server returned an error: (403) Forbidden." error 具有应用程序权限的 PnP Powershell Sharepoint:远程服务器返回错误:(403)禁止 - PnP Powershell Sharepoint with app permissions: The remote server returned an error: (403) Forbidden 使用PowerShell在New-AzureRmDataFactoryPipeline上获取错误 - Getting error on New-AzureRmDataFactoryPipeline using PowerShell 创建了 Powershell 并使用 Invoke-PowerBIRestMethod 来安排 Power BI Refresh 但引发 403 错误 - Created Powershell and using Invoke-PowerBIRestMethod to schedule Power BI Refresh but throws 403 error 通过在Powershell脚本中使用Rest API Post方法无法停止WebJobs-获取错误403-该Web应用程序已停止 - WebJobs not stopping by using the Rest API Post method within powershell script - Getting Error 403 - This web app is stopped 使用PowerShell设置新的smb共享时出错 - Error while setting up a new smb share using powershell 使用Powershell在上下文菜单中添加新项目会出现错误 - Add new item in context menu using powershell gives an error 使用混合使用收益运行New-AzureRmVm的Powershell错误 - Error in Powershell running New-AzureRmVm using hybrid use benefit Connect-PnPOnline:远程服务器返回错误:(403)禁止 - Connect-PnPOnline : The remote server returned an error: (403) Forbidden
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM