internal string NewPage(string blogId, string userName, string password, MWAPage mwaPage, bool publish)
{
if (!Security.IsAuthorizedTo(Rights.CreateNewPages))
{
throw new MetaWeblogException("11", "User authentication failed");
}
var page = new Page
{
Title = mwaPage.title,
Content = mwaPage.description,
Description = string.Empty,
Keywords = mwaPage.mt_keywords
};
if (publish)
{
if (!page.CanPublish())
{
throw new MetaWeblogException("11", "Not authorized to publish this Page.");
}
}
if (mwaPage.pageDate != new DateTime())
{
page.DateCreated = mwaPage.pageDate;
}
page.ShowInList = publish;
page.IsPublished = publish;
if (mwaPage.pageParentID != "0")
{
page.Parent = new Guid(mwaPage.pageParentID);
}
page.Save();
return page.Id.ToString();
}