3

I am using PublishManager.PublishSmart to auto publish items from master db to web db.

New items which are in final workflow state are getting published as expected but for the existing items if I make the changes and reset the workflow state other than final, after auto publish runs this existing item gets deleted from web db.

Here is my code

Database master = Database.GetDatabase("master");
Database targetDB = Factory.GetDatabase("web");

// passing the rootItemID GUID here
var rootItem = master.GetItem(new ID(rootItemID));

Database[] targets = new Database[1] { targetDB };

Language[] array = rootItem.Languages;

PublishManager.PublishSmart(rootItem.Database, targets, array);

1 Answer 1

3

That's expected behavior.

In your scenario, you have an item which does not have any version in final workflow state so it's being removed from web database while publishing.

When you start editing an item which is already published, a new version of that item should be created.

Then if you execute publish and new version is not ready yet, it will keep existing version of that item published in web database. You can still edit new version and finally when it's ready and processed to the final workflow state, it will be published to the web database.

And if any further changes are necessary, you create new draft version of that item again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.