Page is in un-published mode even though DocumentPublishFrom and DocumentPublishTo dates set

Srinivasa Rao Potnuru asked on May 8, 2018 14:34

Page is showing in un-published mode even though DocumentPublishFrom is set as current date and and DocumentPublishTo is set as future date. Page is created using Kentico API as below.

We should be able to create folders under the same page with Kentico API code.

Same code was working fine earlier but not working today. Is there any settings changed to show in un-published mode like in the screenshot.

Need help in resolving this issue.

Code Used to create a page: TreeNode page = tree.SelectNodes().Path(PagePath).OnSite(ObjSiteInfoIdentifier).Culture(Lang).FirstObject;

        TreeNode ObjRootNode = ObjTeeProvider.SelectNodes().Path("/").OnSite(ObjSiteInfoIdentifier).Culture(Lang).FirstObject;

        if (ObjRootNode != null)
            if (page == null)
                TreeNode newPage = TreeNode.New(SystemDocumentTypes.MenuItem, ObjTeeProvider);

                newPage.DocumentName = NewPageName;
                newPage.DocumentCulture = Lang;

                var pageTemplateInfo = CMS.PortalEngine.PageTemplateInfoProvider.GetPageTemplateInfo(PageTemlate);
                newPage.NodeTemplateID = pageTemplateInfo.PageTemplateId;
                newPage.DocumentPageTemplateID = pageTemplateInfo.PageTemplateId;

                newPage.SetValue("DocumentPublishFrom", Convert.ToDateTime(PublishFromDate));
                newPage.SetValue("DocumentPublishTo", Convert.ToDateTime(PublishToDate));


Correct Answer

Juraj Ondrus answered on May 8, 2018 19:02

Hi, are you using workflows? If yes, is the page in the published workflow step? Here is an article that explains difference between content scheduling and workflow.
If you are using workfflow, you should be using this API to update the latest edited version. And then publish the page.

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.