Friday, 29 March 2019

Create Modern Sites in SharePoint Online using PNP Core

SHARE
To install the latest PnP core, go to your Project References > Manage nuget packages.
Download the SharePointPnPCoreOnline component. Its version should be 2.20.1711 or higher (i.e Nov 2017 or higher).You also need to add the statement using OfficeDevPnP.Core.Sites; in your class.

To create a Modern team site, you can use the below code:

TeamSiteCollectionCreationInformation modernTeamSite = new TeamSiteCollectionCreationInformation
{
    Description = "Demo Site description",
    DisplayName = "Demo Modern Team Site",
    Alias = "modernTeamSite",
    IsPublic = true
                         
};

var createModernTeamSite = await context.CreateSiteAsync(modernTeamSite);
SHARE

Author: verified_user

0 Comments: