Virtual Happy Hour canceled for Friday May 31st.

Try our conversational search powered by Generative AI!

Praful Jangid
Feb 6, 2021
  2154
(4 votes)

Bulk publishing of unpublished content items/nodes

In Episerver, we don't have any built in feature that allows us to publish full site (bulk items) in one go. We recently faced one challenge to publish all category nodes.

In CMS, we have an option of Project to perform bulk item update (change of state or publish). But in commerce we don't. And, in our case, we did import of content using custom code and a huge number of items were not published (even we used the SaveAction.Publish).

Then, we decided to write custom code to do that (via scheduled job). And, after doing some RnD, I found that the following Method returns only published items.

ContentRepository.GetChildren<T>(ContentReference contentLink)

Then, the question is how to retrieve the unpublished node/items?

Here is the answer, use the Language option with GetChildren method.

ContentRepository.GetChildren<NodeContent>(parentNode.ContentLink, LanguageSelector.AutoDetect(true))

This is just a trick to get the unpublished items/nodes. And, for bulk publish, you can use the

ContentRepository.Publish(listOfPages);

That's it. You are done.

Thanks

Feb 06, 2021

Comments

Please login to comment.
Latest blogs
Blazor in Optimizely CMS 12 with .NET 8

How to enable support for Blazor components in Optimizely CMS 12 after upgrading to .NET 8.

Ted | May 30, 2024 | Syndicated blog

Build a headless blog with Astro and Optimizely SaaS CMS

I’m a big fan of using the right tool for the right job. I’m also a big fan of Astro , for the right use case. Let's explore Astro to see what it's...

Jacob Pretorius | May 28, 2024

Microsoft announces Natural language to SQL

Finally, Microsoft launches "Natural language to SQL," after it has been available for several months in Optimizely CMS!

Tomas Hensrud Gulla | May 23, 2024 | Syndicated blog

Five easy ways to start personalizing your content right now

If you clicked on this article, you already know that getting the right message to the right person at the right time helps drive conversions and...

Kara Andersen | May 23, 2024

ExtendedCms.TinyMceEnhancements – serwer side webp support

Today I will introduce another small feature of TinyMceEnhancements plugin. The functionality is used to automatically detect whether a browser...

Grzegorz Wiecheć | May 22, 2024 | Syndicated blog

Azure AI Language– Detect Healthcare Content in Optimizely CMS

In this blog post, I showcase how the Azure AI Language service's Text Analytics for health feature can be used to detect healthcare content within...

Anil Patel | May 22, 2024 | Syndicated blog