Kentico 11-12 upgrade BaseAbstractInfoProvider

Targutai Yesugei asked on November 18, 2019 12:53

Hello! In Kentico 11 we retrieved document category id like this

DocumentToProductsCodeName = "DocumentstoProducts6442498230";
DocumentToProductsCategoryID = BaseAbstractInfoProvider.GetId("cms.category", DocumentToProductsCodeName);

Kentico 12 Upgrade tool says that I need to use CMS.DataEngine.AbstractInfoProvider<TInfo, TProvider, TQuery> instead.

Again, the problem is that there is no examples i found. Can someone suggest links to example, or show me how can I get category id by name in Kentico 12? Thank you.

Correct Answer

Roman Hutnyk answered on November 18, 2019 13:06

According to API documentation there is CategoryInfoProvider. See example:

// Gets the page category
CategoryInfo category = CategoryInfoProvider.GetCategoryInfo("Carnivores", SiteContext.CurrentSiteName);
1 votesVote for this answer Unmark Correct answer

Recent Answers


Targutai Yesugei answered on November 18, 2019 13:14

Roman, thank you for pointing this!

0 votesVote for this answer Mark as a Correct answer

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