Pages

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

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