Created
March 13, 2017 14:43
-
-
Save chrisobriensp/1ccf1d7c74b830397b3742d5211ca09b to your computer and use it in GitHub Desktop.
Shows PnP core methods to create/modify modern SharePoint pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void createPage(ClientContext siteContext, string pageName) | |
| { | |
| ClientSidePage page = new ClientSidePage(siteContext); | |
| ClientSideText txt1 = new ClientSideText() { Text = "COB test" }; | |
| page.AddControl(txt1, 0); | |
| // page will be created if it doesn't exist, otherwise overwritten if it does.. | |
| page.Save(pageName); | |
| } | |
| private static void modifyExistingPage(ClientContext siteContext, string pageName) | |
| { | |
| // load exising page - will return null if no page found with this name.. | |
| ClientSidePage page = ClientSidePage.Load(siteContext, pageName); | |
| ClientSideText txt1 = new ClientSideText() { Text = "COB test" }; | |
| page.AddControl(txt1, 0); | |
| page.Save(pageName); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment