Kentico 12 MVC export/import page categories issue

S T asked on January 23, 2024 15:44

Hi, I exported Site with pre-selection after a certain date. It exported Categories and Pages but locally f.e. Page1 has Category1 and Category2 but on after a successful import (where it said in the log Import Pages, Importing Page categories, Importing Content categories)and on the other website I got the pages and the categories BUT the categories weren't added to the page. When I went to Page1 and Categories tab it says "No category selected". What is causing the issue here and did anybody have the same issue ? Regards

Recent Answers

Brenden Kehren answered on January 23, 2024 17:11

Pages and cateories are linked by DocumentID (integer) and CategoryID (integer). It's not a very robust way to link them. What you're probably seeing is the Category ID or Document ID is different in the environment you're importing the data to vs. the data you exported the site from. A simple query against the CMS_Category table in both environments will help verify this.

1 votesVote for this answer Mark as a Correct answer

S T answered on January 24, 2024 10:38

You are right, the CategoryIDs are different. How does this happen if I took a db backup which had no categories at all. Restored that database on my machine and created the category, exported it and imported on another server (where the same db was restored as on my machine) so the autoincrement on the CategoryID should be the same when creating/importing. What happened in that process and is there a way to fix it ? Regards

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 24, 2024 15:31

You cannot guarantee the category IDs will be the same using the Kentico Export/Import process. The only way to 100% insure the IDs are the same would be to do a SQL Import into your new database and ensure you can do an identity insert.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.