BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler.NewPage C# (CSharp) Method

NewPage() private method

wp.newPage method
private NewPage ( string blogId, string userName, string password, BlogEngine.Core.API.MetaWeblog.MWAPage mwaPage, bool publish ) : string
blogId string blogID in string format
userName string login username
password string login password
mwaPage BlogEngine.Core.API.MetaWeblog.MWAPage The mwa page.
publish bool if set to true [publish].
return string
        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();
        }