Create Modern Team site using PnP Core - Invalid value specified for property 'mailNickname' of resource 'Group'

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/237602

Question

I tried to create a modern team site using PnpCore. I tried to do it according the Create Modern Sites in SharePoint Online using CSOM , using the newer SharepointPnPCore Online 2.24.1803

TeamSiteCollectionCreationInformation modernteamSiteInfo = new TeamSiteCollectionCreationInformation
{
    Description = "Test modern teamsite description",
    DisplayName = "Test Modern Team Site",
    Alias = "https://tenantname.sharepoint.com/sites/TestModernTeamSite",
    IsPublic = true,
    //Classification="IT"                       
};

var createModernSite = await context.CreateSiteAsync(modernteamSiteInfo);

I end up with following error message:

{"error":{"code":"-1, System.Data.Services.Client.DataServiceClientException","message":{"lang":"en-US","value":"{\"odata.error\":{\"code\":\"Request_BadRequest\",\"message\":{\"lang\":\"en\",\"value\":\"Invalid value specified for property 'mailNickname' of resource 'Group'.\"},\"requestId\":\"256331ca-f5a9-4664-b48f-355747cb25d5\",\"date\":\"2018-03-12T09:29:40\",\"values\":[{\"item\":\"PropertyName\",\"value\":\"mailNickname\"},{\"item\":\"PropertyErrorCode\",\"value\":\"InvalidValue\"}]}}"}}}

Did I miss anything?

Était-ce utile?

La solution

Creating a modern team site also creates unified group in Office365 that is associated with the newly created team site.

The PnP package takes care of this but under the hood it seems that alias name is used as mailNickName property for the underlying Office365 group and it cannot contain special characters like slash(/), colon(:) etc.

Try giving alias name without special characters and spaces (or allowed special characters) and it should work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top