Try our conversational search powered by Generative AI!

Praful Jangid
Feb 6, 2021
  2094
(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
Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog