daily pastebin goal


a guest Dec 7th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand