pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
987 stars 665 forks source link

Error Running New-PnPSite #2647

Open hughlian opened 4 years ago

hughlian commented 4 years ago

Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Apply-SPOProvisioningTemplate or Get-SPOProvisioningTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/OfficeDev/PnP-PowerShell/tree/master/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/officedev/PnP-Sites-Core/issues

Reporting an Issue or Missing Feature

I am reporting an error that I believe is occuring in the provisioning engine

Expected behavior

A new team site will be created in the tenant

Actual behavior

An error is shown running the command New-PnPSite.

Error Text New-PnPSite : {"error":{"code":"-1, System.Data.Services.Client.DataServiceClientException","message":"{\"odata.error\":{\"c ode\":\"Request_ResourceNotFound\",\"message\":{\"lang\":\"en\",\"value\":\"Resource 'ae6d6863-9526-4c19-9783-ea22fbf58718' does not exist or one of its queried reference-property objects are not present.\"}}}"}} At C:\Users\HughO\Documents\WorkDocuments\Connectics\Documents\ConnectToTenant&CreateNewSite.ps1:22 char:5

Upon running the code again it says that the alias already exists but no site of that name is shown in the admin center.

Steps to reproduce behavior

`$username = "" $password = "" $encpassword = convertto-securestring -String $password -AsPlainText -Force $Credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $encpassword

$SourceUrl = 'https://yourtenantname.sharepoint.com' Write-Host "Connecting to " $SourceUrl

if($Credentials) { Connect-PnPOnline -Url $SourceUrl -Credentials $Credentials Start-Sleep -s 3 } else { Connect-PnPOnline -Url $sourceUrl -SPOManagementShell -ClearTokenCache Start-Sleep -s 3 }

try { New-PnPSite -Type TeamSite -Title 'ZzTestSite1' -Alias 'ZzTestSite1' -IsPublic }

catch { $ErrorMessage = $_.Exception.Message } Write-Output $ErrorMessage`

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name *pnppowershell* -ListAvailable)

How did you install the PnP-PowerShell Cmdlets?

ghost commented 4 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

jimmo120313 commented 4 years ago

Same issue has been found in one of our tenant when trying to create modern team site. We are using PnP Powershell version 3.17.2001.2 _New-PnPSite : {"error":{"code":"-1, System.Data.Services.Client.DataServiceClientException","message":"{\"odata.error\":{\"code\":\"Request_ResourceNotFound\",\"message\":{\"lang\":\"en\",\"value\":\"Resource 'df3ce207-45e5-42ee-aec3-6c2c5b23f179' does not exist or one of its queried reference-property objects are not present.\"}}}"}} at run.ps1: line 168_

I've tried with C# using PnP-Sites-Core(version:3.20.2004) as well, same error:

_OfficeDevPnP.Core: {"error":{"code":"-1, System.Data.Services.Client.DataServiceClientException","message":"{\"odata.error\":{\"code\":\"Request_ResourceNotFound\",\"message\":{\"lang\":\"en\",\"value\":\"Resource 'bcaaa455-921c-4ad9-8b14-835f91dcc989' does not exist or one of its queried reference-property objects are not present.\"}}}"}}._

Please help!!!

tallday commented 4 years ago

related ticket Ticket 2632

KoenZomers commented 4 years ago

Try adding -Description "some value" to your New-PnPSite command, like so:

New-PnPSite -Type TeamSite -Title 'ZzTestSite1' -Alias 'ZzTestSite1' -IsPublic -Description "something"

This fixes it for me. I have submitted this PR https://github.com/pnp/PnP-Sites-Core/pull/2670 to PnP Sites Core to remove the description from being mandatory.

Let me know if adding a description resolves it for you as well.