Sitecore custom publish agent from specific node and at a specific time

Hi all,

As you all know, scheduled publishing will not run automatically unless you enable PublishAgent task in Sitecore config.

By default, all items that are in publish queue will get published when this task triggers. This includes all items in the final workflow state and all items that don't have workflows. Sometimes this is not what you want. Maybe you don't enable workflow on media items and you don't want the items to go live when they are not ready.

The workaround is to create your own PublishAgent task. Looking at the one provided, we can easily extend the code to insert the RootItem to the PublishOptions (this only works with Full or Smart publish mode however):

You will notice that on the Run method I check whether the server time is around the time I set in the parameter (thanks to this post for the code). This will enable us to run the task near the specific time we set (e.g. midnight).

In the config patch, just add this to enable the custom agent:

There you go. You can monitor your Publishing log file to see if the task is properly triggered. Don't forget to disable the task in the SwitchMasterToWeb config as well.

HTH,
Andreas

28 comments

This blog is having the general information. Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful. android Training in Chennai

Reply

I just see the post i am so happy to the communication science post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be replay for your great thinks and I hope you post again soon.

SEO Training in Chennai

Reply

Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
Digital Marketing Company in India
Seo Company in India

Reply

I am regular visitor of this blog .I am working as blog reviewer in a private press and I saw many useful posts here. Sure, I will give best ratings for this blog .Keep posting best posts like this to get top reviews and ratings from blog reviewers and people .And I am thankful for this valuable post.
Nautical Science Colleges in Chennai | Mechanical Colleges in Chennai | ECE Colleges in Chennai

Reply

Great post! I am see the programming coding and step by step execute the outputs.I am gather this coding more information. It's helpful for me my friend. Also great blog here with all of the valuable information you have.
Web Development Company in India

Reply


You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...

Android App Development Company

Reply

Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well
iOS App Development Company
iOS App Development Company

Reply

You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
Fitness SMS
Fitness Text
Salon SMS
Salon Text
Investor Relation SMS
Investor Relation Text

Reply

great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
web design Company
web development Company
web design Company in chennai
web development Company in chennai
web design Company in India
web development Company in India

Reply

it is really amazing...thanks for sharing....provide more useful information...
Mobile app development company

Reply

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us

Vmware Training in Chennai

Web Designing Training in Chennai

AWS Training in Chennai

Linux Training in Chennai

Microsoft Azure Training in Chennai

Reply

This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
Picture printing online
Order photo prints online
Photo printing sites

Reply

Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
Android Training in Chennai
Ios Training in Chennai

Reply

Article is very different in the topic points and the way of writing.Keep updating more articles.

Python Training in Chennai

Reply

Great post! I am actually getting ready to across this information, It's very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.

Selenium Training in Chennai

Reply

These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
PSD to Wordpress
wordpress website development

Reply

This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
Web development company in bangalore
Outsource magento ecommerce services india
ECommerce Website developers in bangalore

Reply

Omrdeals.in is an online platform that allows people to find offers and the greatest deals in and around OMR. It is the directory of the business in and around omr. It helps internet users to surf the required deals and offers.

Offers in Chennai

Reply

Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates. ecommerce platforms

Reply

This post is very simple to read and appreciate without leaving any details out. Great work! digital photo retouching

Reply

I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles. chocolate day

Reply

A debt of gratitude is in order for the blog entry amigo! Keep them coming... falls creek apartments

Reply

I'm happy to see the considerable subtle element here!. valentines day gift Web Solutions company

Reply

I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles. Graco 4Ever 4-in-1 convertible car seat Vs Graco Extend2Fit Convertible Car Seat compare

Reply

I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles. private label manufacturers

Reply

I will really appreciate the writer's choice for choosing this excellent article appropriate to my matter.Here is deep description about the article matter which helped me more. PhenQ Ingredients

Reply

I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details. wordpress autoblog setup

Reply

Post a Comment