Create publishing pages sharepoint 2010 programmatically |
Below is an example of Adding a New Publishing Page to the SharePoint 2010 Site Pages Library PublishingWeb publishingWeb = PublishingWeb. string pageName = “MyCustomPage.aspx”; PageLayout[] pageLayouts = publishingWeb. PageLayout currPageLayout = pageLayouts[0]; PublishingPageCollection pages = publishingWeb. PublishingPage newPage = pages.Add(pageName, newPage.ListItem[FieldId. newPage.ListItem.Update(); newPage.Update(); newPage.CheckIn(“This is just a comment”); In the code above a PageLayout instance with index 0 is selected from all the available page layouts. By using the PageLayout instance, a new page of type PublishingPage is added to the site pages library. Afterward, the content of a field, identified by FieldId.PublishingPageContent, is set to a HTML text value, followed by an update and check-in. |
Monday, November 28, 2011
Create publishing pages sharepoint 2010 programmatically
Category:
SharePoint 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment