Forum Discussion
Cannot create list or add site column using PNP PowerShell
Hi,
I have a development tenant where I am SharePoint Administrator.
I want to create some site columns, content types and lists, on a specific site, so I am using PnP PowerShell.
When I run the command
- New-PnPList -Title testList -Template GenericList
I get the following error
I'm a site collection administrator, but SharePoint won't assume my permissions.
I have tried the same actions on 2 other development tenants and a production tenant and I can perform the actions I want, this issue only occurs on this particular office 365 developer tenant.
PowerShell Code:
- Connect-PnPOnline -Url {SITEURL}
- $web = Get-PnPWeb
- $currentUser = $web.CurrentUser
- $web.Context.Load($currentUser)
- $web.Context.ExecuteQuery()
- $web
$currentUser
$currentUser.IsSiteAdmin - New-PnPList -Title testList -Template GenericList
output:
Bellow I show some images confirming my statements.
Hi everyone, I asked this question on another forum and using Connect-PnPOnline -Url{site url} -UseWebLogin I was able to do the creations.
Thank you very much
- I'm guessing you are using legacy auth,
try this:
Connect-PnPOnline -Url "YourSite" -Interactive
New-PnPList -Title testList -Template GenericList- duarte_AguiarCopper Contributor
NicolasKheirallahI had already tried your solution and even so I can't carry out the creation, on this site, from this specific development tenant. In others I can
- Have you tried in another site? does it work there?