Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Non published page properties is null?


If you're logged in as an editor non published pages shows up pagelists, if you want to. But only built-in properties, e.g. PageName, have values. Is this by design? Is there a way to populate all defined properties too?

Oct 18, 2011 18:20

Just to clearify, I'm using the GetPages() method in DataFactory and binds the collection to the pagelist. All properties are null, except built-in ones, in the collection GetPages() returns.

Oct 18, 2011 18:29

Use PageVersion.List to get hold of the version-specific references to the page. If there are several verisons I think they are ordered with the newest version first in the returned array. Then use GetPage with the versioned reference instead of the original page reference.

Oct 18, 2011 21:46

In my case there is only one version, the non published one. I'm creating a new page and just saves it.

Oct 18, 2011 22:10

In CMS 5 I think I used this code to get all children (published/not published)

        public PageDataCollection GetChildrenAndNotPublished(PageReference pageRef, string langID)
            PageDataCollection result = EPiServer.DataFactory.Instance.GetChildren(pageRef, new LanguageSelector(langID));

            PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();
            PropertyCriteria pubCriteria = new PropertyCriteria();
            pubCriteria.Condition = EPiServer.Filters.CompareCondition.Equal;
            pubCriteria.Name = "PagePendingPublish";
            pubCriteria.Type = PropertyDataType.Boolean;
            pubCriteria.Value = true.ToString();
            pubCriteria.Required = true;

            PropertyCriteria pubCriteria2 = new PropertyCriteria();
            pubCriteria2.Condition = EPiServer.Filters.CompareCondition.Equal;
            pubCriteria2.Name = "PageParentLink";
            pubCriteria2.Type = PropertyDataType.PageReference;
            pubCriteria2.Value = pageRef.ToString();
            pubCriteria2.Required = true;

            PageDataCollection matches = DataFactory.Instance.FindPagesWithCriteria(pageRef, criterias, langID);
            foreach (PageData match in matches)
                PageReference realReference = new PageReference(match.PageLink.ID, true);
                PageData unPublishedPageData = EPiServer.DataFactory.Instance.GetPage(realReference,
                                                                                      new LanguageSelector(langID));
            return result;

Oct 18, 2011 22:17

Guess I can only check all pages and if they are not published just get them using new PageReference(match.PageLink.ID, true);

Oct 18, 2011 22:18

The problem isn't that non-published pages shows up or not in the pagelist. The problem is that all properties are not populated with data, even if it has data. Only built-in properties gets populated with data.

Will PageReference(match.PageLink.ID, true); really solve that problem? Then I have to loop thru all my pagereferences... Performance-wise I guess that the new GetPages() is much faster.

Oct 18, 2011 22:29

I think you need to GetPage on each of the pages that is non-published

Oct 18, 2011 22:31

Seems like a bug to me if not GetPage and GetPages behaves the same way.

But I'll have to check tomorrow if getting the pages with any version flag set to true makes any difference.

Oct 18, 2011 22:45

This has been reported as a bug,EPiServer CMS,74317,jS0N%2fMhWc1DmNtx5OZX%2bmmcRJqI%3d,EPiServer CMS,74317,jS0N%2fMhWc1DmNtx5OZX%2bmmcRJqI%3d
Nov 30, 2011 14:30

It has been reported as a bug (actually several times) but I'm not sure that we'll fix it. The problem is that published data lies in tblPage and tblProperty while unpublished pages/versions lies in tblWorkPage and tblWorkProperty. When a GetPage is executed in the database without any specific version requested it will try to fetch the data from the tblPage/tblProperty tables. For non-published pages there is data in tblPage but not tblProperty and that's why some metadata is returned but not custom properties.

I agree that it's a flaw and have been forced to do quite alot work arounds over the years when working in the UI where we often work with unpublished versions. But fixing this would require checking state in tblProperty and then fetching from either tblPage/tblProperty or tblWorkPage/tblWorkProperty which would complicate the logic and affect performance.

In our internal discussions we have been leaning on leaving it as it it as we consider performance more important than the actual glitch in this case. What are your opinions?

Dec 01, 2011 8:06

Hi Linus,

Thanks for the answer. I also think performance is more important and in my case I can really filter out un-published pages instead. Maybe you could add an overload to GetPages to filter out these pages? Or do you recommend to filter them out manually affterwards? Performance wise I guess it would be better to not fetch them at all.

I also think this behaviour i quite strange, maybe not if you only have "presentational" properties but if you have "logical" ones, like "DontShowMeInThisList" it can get quite messy.

Dec 01, 2011 10:40

For your information. This has now been fixed and will be available in our next major release.

With the fix data for page type properties for unpublished are always loaded regardless if the pages is loaded through GetPages, GetChildren or GetPage (before the fix data was loaded correctly for GetPage but wrongly for GetPages and GetChildren).

This also solves the related issues for copy/export of unpublished pages where data where not copied/exported.

Dec 05, 2011 15:31
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.