Guest User

Untitled

a guest
Dec 7th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. PublishingPageInformation publishingPageInfo = new PublishingPageInformation();
  2. publishingPageInfo.Name = pageFileName // Set file name here;
  3. publishingPageInfo.PageLayoutListItem = layout // Url of the page layout inside master page gallery;
  4. // Adding new page to web.
  5. PublishingPage publishingPage =pubWeb.AddPublishingPage(publishingPageInfo);
  6. publishingPage.ListItem["Title"] = pageTitle; //title of the page
  7. publishingPage.ListItem.Update();
  8. _ctx.Load(publishingPage.ListItem);
  9. _ctx.ExecuteQuery();
  10. pageURL = publishingPage.ListItem["FileRef"].ToString(); // this will give you the URL of the page added
Add Comment
Please, Sign In to add comment