Programmatically created page not visible in edit mode tree

Vote:
 

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)

#80593
Jan 27, 2014 14:56
Vote:
 

Maybe there is a constraint enforcing different property values?

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

#80595
Jan 27, 2014 15:14
Vote:
 

Can you paste type definition for CourseDetailsPage?

#80616
Jan 28, 2014 8:15
Vote:
 

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.

#80617
Edited, Jan 28, 2014 8:31
Vote:
 

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?

#80624
Jan 28, 2014 9:25
Vote:
 

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.

#80628
Jan 28, 2014 9:59
Vote:
 

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.

#80629
Jan 28, 2014 10:18
Vote:
 

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 :))

#80635
Edited, Jan 28, 2014 11:26
Vote:
 

I am creating pages:

A few more examples:

Url segment of pages not visible in tree:

http://xxxxxx/no/kurs-og-konferanser/kurskalender/firmaforum-2014/
http://xxxxxx/no/kurs-og-konferanser/kurskalender/skattedagene-2014/
http://xxxxxx/no/kurs-og-konferanser/kurskalender/skattedagene-20141/
http://xxxxxx/no/kurs-og-konferanser/kurskalender/skattedagene-20142/

Last two instances of each page visible:
http://xxxxxx/no/kurs-og-konferanser/kurskalender/firmaforum-20144/
http://xxxxxx/no/kurs-og-konferanser/kurskalender/skattedagene-201413/

 

Even though the page isn't visible in the tree, I can access the pages if passing the id in url:
http://xxxxxxx/Cms/#context=epi.cms.contentdata:///218

 

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.

#80640
Jan 28, 2014 12:13
Vote:
 

Hi,

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.

#115803
Jan 19, 2015 13:31
Vote:
 

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: http://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2014/10/23-Video-content-provider/

#116096
Jan 23, 2015 8:53
Vote:
 

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.

#116097
Jan 23, 2015 9:04
Vote:
 

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

#116144
Jan 23, 2015 15:59