create a sharepoint online page based on custom template c#

nellie 106 Reputation points
2021-02-19T18:30:14.1+00:00

Hi I have created a page template on SharePoint using this article https://petri.com/sharepoint-page-templates-have-finally-arrived-heres-how-to-use-them

Now I want to use it my c# code but I don't know-how

THANK YOU

using (var ctx = authMgr.GetSharePointOnlineAuthenticatedContextTenant(siteUrl, userName, password))
            {
                Web web = ctx.Web;
                ctx.Load(web.Lists);
                ctx.Load(web, w => w.SupportedUILanguageIds);
                ctx.Load(web);

                ctx.ExecuteQueryRetry();
                //Create the Page
                var page2 = ctx.Web.AddClientSidePage("PageWithSections.aspx",true);                  <------ STUCK HERE
                page2.AddSection(CanvasSectionTemplate.TwoColumnRight, 5);


                //page2.AddSection(CanvasSectionTemplate.TwoColumn, 10);
                page2.Save();
Microsoft 365 and Office | SharePoint Server | Development
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.