Unpublishing a document

Yehuda Lando asked on July 2, 2014 03:18

Hi,

I want to unpublish documents according to a certain document value. I have a global event handler set up to do this, but I can only find how to do this under a workflow or using the "publish to" field.

Is there a way to do it immediately without using the publish to field?

Thanks

Recent Answers


Joshua Adams answered on July 2, 2014 08:38

You could go into the listing view of the pages and use that interface. There isn't an unpublish, but there is an archive. Not sure if that works for you.

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on July 2, 2014 08:44

I did this in the end:

To unpublish:

node.SetValue("DocumentPublishTo", DateTime.Now.AddDays(-1));
node.Update();

To publish:

node.SetValue("DocumentPublishTo", null);
1 votesVote for this answer Mark as a Correct answer

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