Hi
I have referred the following links, but these references uses OfficeDevPnp which doesn't work for me.
Please let me know the solution using C# or Pnp.framework if possible.
Thanks in advance
Hi
I have referred the following links, but these references uses OfficeDevPnp which doesn't work for me.
Please let me know the solution using C# or Pnp.framework if possible.
Thanks in advance
Hi @Nancy-0218 ,
Currently, some functionalities are not complete in PnP.framwork. And we can not create modern page with PnP.framework now. Below is the ClientSidePage class in PnP.Framework, it's incomplete.

So I would sugeest you use SharePointPnPCoreOnline to create modern pages.
And you can read this offical articles to create modern page and add custom SPFx webpart: https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-pages
Below is the sample in the article:
ClientSidePage p = new ClientSidePage(cc);
// get a list of possible client side web parts that can be added
var components = p.AvailableClientSideComponents();
// Find our custom "HelloWord" web part
var myWebPart = components.Where(s => s.ComponentType == 1 && s.Name == "HelloWorld").FirstOrDefault();
if (myWebPart != null)
{
// Instantiate a client side web part from our found web part information
ClientSideWebPart helloWp = new ClientSideWebPart(myWebPart) { Order = 10 };
// Add the custom client side web part to the page
p.AddControl(helloWp);
}
// Persist the page to SharePoint
p.Save("PnPRocks.aspx")
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
5 people are following this question.