Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Non published page properties is null?

Vote:
 

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?

#54481
Oct 18, 2011 18:20
Vote:
 

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.

#54482
Oct 18, 2011 18:29
Vote:
 

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.

#54483
Oct 18, 2011 21:46
Vote:
 

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

#54485
Oct 18, 2011 22:10
Vote:
 

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;
            criterias.Add(pubCriteria);

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

            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));
                result.Add(unPublishedPageData);
            }
            return result;
        }

#54487
Oct 18, 2011 22:17
Vote:
 

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

#54488
Oct 18, 2011 22:18
Vote:
 

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.

#54489
Oct 18, 2011 22:29
Vote:
 

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

#54490
Oct 18, 2011 22:31
Vote:
 

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.

#54492
Oct 18, 2011 22:45
Vote:
 

This has been reported as a bug http://world.episerver.com/Support/bug-list/#bug,EPiServer CMS,74317,jS0N%2fMhWc1DmNtx5OZX%2bmmcRJqI%3d

http://world.episerver.com/Support/bug-list/#bug,EPiServer CMS,74317,jS0N%2fMhWc1DmNtx5OZX%2bmmcRJqI%3d
#55380
Nov 30, 2011 14:30
Vote:
 

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?

#55396
Dec 01, 2011 8:06
Vote:
 

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.

#55402
Dec 01, 2011 10:40
Vote:
 

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.

#55491
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.