Non published page properties is null?

Member since: 2007

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
  • Member since: 2007

    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
  • Member since: 2008

    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
  • Member since: 2007

    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
  • Member since: 1996

    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
  • Member since: 1996

    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
  • Member since: 2007

    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
  • Member since: 1996

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

    #54490 Oct 18, 2011 22:31
  • Member since: 2007

    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
  • Member since: 2007

    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
  • Member since: 2002

    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
First   1 2   Last