Try our conversational search powered by Generative AI!

Programmatically created page not visible in edit mode tree


I have created a few items/pages using the following code:

var cp = contentRepository.GetDefault<CourseDetailsPage>(startpage.CoursesPage, coursePageTypeId);

if (cp != null)
cp.PageName = course.CourseTitle;
cp.Name = course.CourseTitle;
cp.CourseDuration = course.Duration.ToString();
cp.MetaTitle = course.CourseSubtitle;
cp.CourseID = course.CourseNo;
cp.OnlineTraining = course.WebCourse == "J";
cp.TeaserText = course.Freetext;
cp.CourseRootCategory = course.Categories;

cp.URLSegment = Web.UrlSegment.CreateUrlSegment(cp);

contentRepository.Save(cp, SaveAction.Publish, Security.AccessLevel.NoAccess);



Content exists in database, and I am able to access the pages, but they are not visible in the tree in edit mode.
That said. The last page created are visible, but not the remaining pages.

I can see the pages if I go into Admin mode - Access right tree, but not in edit mode.


A known bug, or something i am missing ?

(Using EPiServer 7.5)

Jan 27, 2014 14:56

Maybe there is a constraint enforcing different property values?

Adding Guid values to the different properties caused the pages to appear in the tree.

Jan 27, 2014 15:14

Can you paste type definition for CourseDetailsPage?

Jan 28, 2014 8:15

Nothing special about it.

CourseDuration - String, not required
cp.MetaTitle - String, not required
cp.CourseID - String, not required
cp.OnlineTraining - Boolean, not required
cp.TeaserText - string, not required
cp.CourseRootCategory - string, not required


Since my dummy import contained the same data, I was confused.
After changing to different values, the pages/content appeared in the edit tree.

The dummy-data option works in EPiServer 6.

Edited, Jan 28, 2014 8:31

It's just a wild guess - not sure about case when you see last page created, but what about language branches? Do you have only one language and you are creating pages in the branch? Is course.CourseTitle the same? Which properties are equal in data source you are reading from?

Jan 28, 2014 9:25

All the pages created on the same language branch.
Tried both norwegian and english for test.

Looking in the old pagetree in admin mode (where you set access) displays all the pages.
Looking in edit mode the pages are not visible in edit mode.

Since I have multiple pages with equal names (different locations have different descriptions), I was thinking it may have something to do with the PageName. After modifying the import while testing, appending a Guid.NewGuid on the properties the pages display in the tree.

Jan 28, 2014 9:59

Ok. I'm not aware of the logic behind the page tree loader - but could be related to Url segment - as you are able manually to create new page with name that already exists at the same level in page tree - but EPi automatically adds "counter" at the end of the url. I can see from code that CreateUrlSegment should handle counter as well. Check urls for the pages you created.

Jan 28, 2014 10:18

Is the CourseDetailsPage a page or a block? If it's a block it will not be displayed iin the tree, but in the access tree

(From the name it should be a Page :))

Edited, Jan 28, 2014 11:26

I am creating pages:

A few more examples:

Url segment of pages not visible in tree:


Last two instances of each page visible:


Even though the page isn't visible in the tree, I can access the pages if passing the id in url:


Seems like duplicate pagenames are filtered out in some way in the tree...

Again. The access-rights tree in admin mode displays all the pages. Issue only in edit mode.

Jan 28, 2014 12:13


Despite the necro, I had this very same problem just now, everything fine except items not showing up in the "dojo" page tree.

The only thing that worked for me was to, in my content class, inherit PageData. If I did as some examples suggest and inherit ContentBase, items would not show up in the edit mode page tree.

If there is another solution, please advise.

Jan 19, 2015 13:31

The page tree's purpouse is to list pages, meaning items that inherit from PageData. You can surely create other content, for instance inheriting from ContentBase, but that means that you need to add a view to be able to browse content of this type, for instance like done in the blog post:

Jan 23, 2015 8:53

Of course, it makes perfect sense. Although, it get a bit confusing if you enter the admin mode and use the "set access rights" function, where the content is indeed shown, despite not being pages. Obviously, the admin function shows all content (with media etc being in the global assets container), but now we have a situation where content not inheriting pagedata, but having a entrypoint somewhere in the page tree is simply nowhere to be found in the edit mode.

A small note on the content provider documentation page about this fact would have saved me a few hours of debugging. Also, page acting as entry point actually do have the plus sign next to it, denoting there is something under there, but if you click it, nothing is shown.

Also, while we are on the topic of page providers, it would also be useful to have a small section on the content provider documentation stating that you must create a partial router if you intend to use your external content as pages. Because while they do work just fine in edit mode, and the generated external url for them is correct, if you try to browse using the external url, you would get a 404.

Jan 23, 2015 9:04

Thanks for the feedback. I've forwarded it to the team working with this area.

Jan 23, 2015 15:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.