public string CreatePage(string pageName, string sectionId)
{
string pageId;
try
{
_mApp.CreateNewPage(sectionId, out pageId, NewPageStyle.npsBlankPageWithTitle);
// Get the title and set it to our page name
string xml;
_mApp.GetPageContent(pageId, out xml, PageInfo.piAll);
var doc = XDocument.Parse(xml);
var ns = doc.Root.Name.Namespace;
var title = doc.Descendants(ns + "T").First();
title.Value = pageName;
// Update the page
_mApp.UpdatePageContent(doc.ToString());
}
catch (Exception e)
{
throw new ApplicationException("Error in CreatePage: " + e.Message, e);
}
return pageId;
}