Advertisement

Responsive Advertisement

Create Communication 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:


CommunicationSiteCollectionCreationInformation communicationSite = new CommunicationSiteCollectionCreationInformation
{
    Title = "Demo Communication Site",
    Url = "https://gowtham.sharepoint.com/sites/Demo",
    SiteDesign = CommunicationSiteDesign.Topic,
    Description = "Demo modern communication site description",
    Owner = "gowtham@tenant.onmicrosoft.com"
    AllowFileSharingForGuestUsers = true
   };

var createCommSite = await context.CreateSiteAsync(communicationSite);

Post a Comment

0 Comments