Forum Discussion
Creating modern site with PnP powershell
- Oct 24, 2017
I 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.
https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/SetPnPTraceLog.md
- Dean_GrossOct 24, 2017Silver Contributor
kevmcdonk, 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.NewSiteIt appears that the Alias attribute cannot accept strings that contain spaces. Erwin van Hunen is this an expected limitation?
- Oct 24, 2017
I 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.
- Dean_GrossOct 24, 2017Silver Contributor
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