Pages

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

Gowtham

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.

No comments:

Post a Comment