Oct 20 2017 10:44 AM
I'm getting the following error with the latest PnP Online module. Does this work for anyone?
New-PnPSite -Type TeamSite -Title Portfolio -Alias pc
New-PnPSite : Object reference not set to an instance of an object.
At line:1 char:1
+ New-PnPSite -Type TeamSite -Title Portfolio -Alias pc
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [New-PnPSite], NullReferenceException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.NewSite
Oct 21 2017 09:14 AM
Oct 21 2017 09:30 AM
Oct 24 2017 09:40 AM - edited Oct 24 2017 10:05 AM
@Kevin McDonnell, Thanks, I have enabled the log and it is empty. That got me thinking and when I add -Verbose, I get the following :
New-PnPSite : {"error":{"code":"-1, System.Data.Services.Client.DataServiceClientException","message":{"lang":"en-US","value":"{\"odata.error\":{\"code\":\"Request_BadRequest\",\"mess
age\":{\"lang\":\"en\",\"value\":\"Invalid value specified for property 'mailNickname' of resource 'Group'.\"},\"requestId\":\"6a52863d-e6c9-49f7-a696-ec373b4e4add\",\"date\":\"2017-1
0-24T16:42:25\",\"values\":[{\"item\":\"PropertyName\",\"value\":\"mailNickname\"},{\"item\":\"PropertyErrorCode\",\"value\":\"InvalidValue\"}]}}"}}}
At line:1 char:1
+ New-PnPSite -Type TeamSite -Title Test4 -Alias 'Test 4' -Description ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [New-PnPSite], Exception
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.NewSite
It appears that the Alias attribute cannot accept strings that contain spaces. @Erwin van Hunen is this an expected limitation?
Oct 24 2017 10:34 AM
SolutionI initially was thinking it was due to the way you login, as we fixed an issue with using the -WebLogin parameters. But indeed, in your case it is the mailnickname that is causing the issue, it is not related to your login. Indeed, the Alias parameter value cannot contain a space.
I'll add a check in the backend code for that.
Oct 24 2017 10:38 AM - edited Oct 24 2017 10:39 AM
Thanks, I also realized that I should not connect to the tenant-admin site. Could you add that to the documentation or is that something I should do through a pull request?
Also, why is the MailNickname attribute, referred to as Alias? that confused me because alias already has its own meaning in powershell
Mar 30 2021 02:26 PM
I get the same issue with the following version.
---- -----------------
PnP.PowerShell 1.4.0
----------------------