Saturday, October 24, 2009

Creating a Web Part Page programmatically

Using Microsoft.SharePoint API is often not the most easy thing in the world. As an example adding a web part page programmatically is not an easy job - unless you're lucky and hit the right page on MSDN.

I have been trying to add a pages using the SPFolder.Files.Add(, SPTemplateFileType.StandardPage) - but the page was not added as a WebPartPage so I couldn't add web parts to the page in a proper manner.

It was not until I came across the NewWebPage method on MSDN that I managed to get the job done.

No comments: