Importing category data to Episerver CMS


We have a taxonomy managed by our organisation, and the taxonomy is stored in a file. The taxonomy is a tree consisting of categories (for example School category has subcategories Primary School and Secondary School, and Primary School has subcategories State Primary School and Private Primary School and so on). We would like Episerver to import the taxonomy, and use the taxonomy to categorise pages in Episerver for search etc. If the taxonomy changes in future, Episerver can reimport the taxonomy. Any suggestion is welcome. Thanks!

Mar 24, 2021 14:54


You can create a scheduled job that will read your file and based file data it will create the categories in the Episerver CMS

Example for creating a scheduled job-

Sample code to create categories-

private void CreateIfNotExists(string name, string description, int order)
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");
            if (string.IsNullOrEmpty(description))
                throw new ArgumentNullException("description");

            var categories = CategoryList.LoadCategories();
            if (categories.Contains(name))

            var category = new Category(name, description)
                                   Available = true,
                                   Parent = Category.GetRoot(),
                                   SortOrder = order


FYI - If you have a multilingual site then you can use Geta Categories

Edited, Mar 25, 2021 6:48
Jianhan Zhu - Mar 25, 2021 10:11
Thanks for your helpful suggestions. Where to put the code to create categories, in the Initialization section, or as another scheduled job?
Ravindra S. Rathore - Mar 25, 2021 10:12
In the Scheduled Job
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.