CreateNewStandardPage not working in build 1210
We upgraded from build 1098 to build 1210. The following block of code was running fine for weeks, but immediately after the upgrade it throws the error: Object reference not set to an instance of an object.
I stopped the code in debug and verified that all the variables that are being used in the method chain are valid and not null.
fluent.CreateNewStandardPage(parentNode)
.Do(pn =>
pn.Title = newPageName;
pn.UrlName = newPageName;
pn.Page.Title = newPageName;
pn.InheritsPermissions = myInheritPermissions;
)
.CheckOut()
.SetTemplateTo(guidTemplate)
.Publish()
.SaveChanges();
[NullReferenceException: Object reference not set to an instance of an object.]
Telerik.Sitefinity.Modules.Pages.PageManager.ExecutePublishPageDraft(PageDraft draft, Boolean makeVisible) +1309
Telerik.Sitefinity.Modules.Pages.PageManager.PublishPageDraft(PageDraft draft, Boolean makeVisible) +669
Telerik.Sitefinity.Fluent.Pages.PageDraftFacade.Publish() +251
LessonBuilder.Web.Util.MyPageManager.MakeNewPage(String mainPageName, Boolean isChildToThis, String childPageName, Boolean myInheritPermissions) in C:\CurrentFiles\Projects\LessonBuilder1098\LessonBuilderApp\LessonBuilder.Web\Util\myPageManager.cs:170
Hi Phil,
This code
var pageTemplate = PageManager.GetManager().GetTemplates().First();
var pageFacade = App.WorkWith().Page().CreateNewStandardPage(PageLocation.Frontend).Do(pg =>
pg.Name =
"name"
;
pg.Title =
"title"
;
pg.UrlName =
"someurlname"
;
pg.ShowInNavigation =
true
;
pg.Page.Title =
"datatitle"
;
pg.Page.HtmlTitle =
"htmldatatitle"
;
pg.Description =
"Some description"
;
)
.CheckOut()
.SetTemplateTo(pageTemplate)
.Publish()
.SaveChanges();
Ivan,
I am also getting this same error in SP1. Here is the code that I am using:
PageManager manager = PageManager.GetManager();
var template = manager.GetTemplates().First();
var newPage = App.WorkWith().Page()
.CreateNewStandardPage(PageLocation.Frontend)
.Do(p=>
p.Name =
"FluentAPI Page"
;
p.Title =
"Fluet API Page"
;
p.UrlName =
"fluent-api-page"
;
p.ShowInNavigation =
true
;
p.Page.Title =
"Fluent API Page"
;
)
.CheckOut()
.SetTemplateTo(template)
.Publish()
.SaveChanges();
Hello Richard,
I am not able to replicate this issue using the SP1 and latest internal build. The code creates a new page.
Greetings,
Ivan Dimitrov
the Telerik team