Friday, 29 March 2019

Create Modern Sites in SharePoint Online using PNP Core

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);

1 comment:

  1. I stumbled upon this post and I'm so glad I did! The way you've presented [mention a general idea or concept, e.g., 'the balance between ambition and well-being'

    Delhi Agra Jaipur Tour Packages
    Golden Triangle india Tour Package

    ReplyDelete