Have an issue with a solution with uWebshop and CMSImport.
Sometimes after Import, we get an server error that says "Trying to load multi-store content without a store".
We can solve it by publishing the Store nodes, so an easy fix would be to publish the sote nodes once every day.
So I have the code below, but it does not seem to work. I unpublished a node to test it, but it does not get published.
So I'm guessing I must be missing something or...?
using umbraco.cms.businesslogic.web
foreach(var page in Model.NodeById(1393).Children){
Document d = new Document(page.Id);
umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0);
d.Publish(u);
umbraco.library.UpdateDocumentCache(d.Id);
}
The problem was that looping through nodes will of course not give me unpublished nodes, use Document instead. :-)
This is the working code:
var stores = new Document(1393);
foreach(var d in stores.Children){
umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0);
d.Publish(u);
umbraco.library.UpdateDocumentCache(d.Id);
}
Cannot publish programmatically in 4.11.10
Have an issue with a solution with uWebshop and CMSImport.
Sometimes after Import, we get an server error that says "Trying to load multi-store content without a store".
We can solve it by publishing the Store nodes, so an easy fix would be to publish the sote nodes once every day.
So I have the code below, but it does not seem to work. I unpublished a node to test it, but it does not get published.
So I'm guessing I must be missing something or...?
using umbraco.cms.businesslogic.web foreach(var page in Model.NodeById(1393).Children){ Document d = new Document(page.Id); umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0); d.Publish(u); umbraco.library.UpdateDocumentCache(d.Id); }
This was an easy fix.
The problem was that looping through nodes will of course not give me unpublished nodes, use Document instead. :-)
This is the working code:
is working on a reply...