Skip to content
October 3, 2012 / kiranpatils

Basics of Publishing multiple items programmatically

Challenge:

So long back posted one problem on SDN forum — http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID=45665

We have one functionality where users can select multiple items from different path for example :

/sitecore/content/A/1
/sitecore/content/A/4
/sitecore/content/A/5

Basically, we wanted to publish multiple items in one publishing Job. We asked to Sitecore support guys and they said:

In the comment for your forum post #45665 it completely correctly noted that currently in the Sitecore CMS you can publish either a single item or a whole subtree — not a list of items. You may want to use incremental publishing instead of smart publishing, because it publishes only recently changed items.

Using an incremental publishing was not an option for us. As we have Multisite Sitecore solution.

Solution:

Also, Sitecore support team suggested to use  Alex Shyba’s concept:

http://sitecoreblog.alexshyba.com/2010/07/hidden-feature-of-sitecore-62.html

Where we add item references programmatically. John is also fine with this approach on this thread : http://sdn.sitecore.net/forum//ShowPost.aspx?PostID=36069

So, you can also use it. But with few suggestions:

1.  It may affect performance. So, please test it throughly.

2. If you are using Multisite solution and have custom HTML cache clearing handler on publish:end:remote then make sure that you added same site’s items in one publish job.

Happy Multiple items publishing via code! 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: