I need some help with the site I am building. The scenario is, I have a registration form which the user completes and my code then creates a page;
var user = new User(0);
var portfolioHome = Document.MakeNew(siteUrl, sitePage, user, rootNode.Id); portfolioHome.Save();
I don't want to publish this page, so just saving at this point.
I then create a child page of the page I have just created, but this one I want to publish;
var configuration = Document.MakeNew("Configuration", configurationPage, user, portfolioHome.Id); //set some properties etc configuration.Publish(user);
When I look in the content tree, I see the unpublished page, and it's child "configuration" page, which has a message saying "This document is published but is not visible because the parent is unpublished".
So, i'd expect that when I publish the parent (portfolioHome), the child page (configuration) should remain publlished and be available, but that doesn't appear to be the case, when I publish the unpublished parent, and then look at the child (which was already published according to my code and the message) the "link to document" is "#" and I cannot access this page via it's parent, until I click on the publish button and "re-publish" it?
I have seen various posts in similar issues and have tried the following after the original configuration.Publish(user);
Am I missing something, or is this to be expected, the idea is I want the configuration page to be published as soon as it is created, when the user then publishes the parent portfolio page the config page is already published and the properties can be accessed from the parent, as it is they have to republish the configuration page!
Create and Publish document in API
Hi,
I need some help with the site I am building. The scenario is, I have a registration form which the user completes and my code then creates a page;
var user = new User(0);
var portfolioHome = Document.MakeNew(siteUrl, sitePage, user, rootNode.Id);
portfolioHome.Save();
I don't want to publish this page, so just saving at this point.
I then create a child page of the page I have just created, but this one I want to publish;
var configuration = Document.MakeNew("Configuration", configurationPage, user, portfolioHome.Id);
//set some properties etc
configuration.Publish(user);
When I look in the content tree, I see the unpublished page, and it's child "configuration" page, which has a message saying "This document is published but is not visible because the parent is unpublished".
So, i'd expect that when I publish the parent (portfolioHome), the child page (configuration) should remain publlished and be available, but that doesn't appear to be the case, when I publish the unpublished parent, and then look at the child (which was already published according to my code and the message) the "link to document" is "#" and I cannot access this page via it's parent, until I click on the publish button and "re-publish" it?
I have seen various posts in similar issues and have tried the following after the original configuration.Publish(user);
configuration.PublishWithSubs(new User(0));
umbraco.library.UpdateDocumentCache(configuration.Id);
umbraco.library.RefreshContent();
Am I missing something, or is this to be expected, the idea is I want the configuration page to be published as soon as it is created, when the user then publishes the parent portfolio page the config page is already published and the properties can be accessed from the parent, as it is they have to republish the configuration page!
Cheers
Chris
is working on a reply...