Kentico API: Getting All Culture Variance of a page

Dominic Carvalho asked on October 2, 2018 11:50

Hi All,

I am trying to get all the culture variances using the KenticoAPI for a specific page.

I have a page with two culture variances of it, for example sake the page name is "DemoPage" and it exists in both english (en-EN) and spanish (es-ES).

Below is the code snippit that I am using.

var pages = new TreeProvider().SelectNodes()
.WhereEquals("NodeName","DemoPage")
.OnSite(siteId).Execute();

When I execute the code I always get an dataset back that contains only one record , where I would expect two records one for English and one for Spanish

Regards

Correct Answer

David te Kloese answered on October 2, 2018 13:03

Hi,

try including AllCultures() which ensures retrieval of all cultural versions!

Something like

 new CMS.DocumentEngine.TreeProvider()
   .SelectNodes()
   .WhereEquals("NodeName","Home")
   .OnSite(1)
   .AllCultures()
1 votesVote for this answer Unmark Correct answer

Recent Answers


Dominic Carvalho answered on October 2, 2018 13:32

Hi David,

Thanks, Its working I just added the AllCultures() and it worked.

Regards,

0 votesVote for this answer Mark as a Correct answer

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