API
Version 7.x > API > Question on getting category Count View modes: 
User avatar
Member
Member
hemanthray-gmail - 12/28/2012 1:35:13 PM
   
Question on getting category Count
We use the below to get a set of data for categories for blog.

DataSet ds = CMS.SiteProvider.CategoryInfoProvider.GetCategories("CategoryID IN (SELECT CategoryID FROM CMS_DocumentCategory WHERE DocumentID IN (select DocumentID from CMS_Document where DocumentNamePath like '%/Blog/%') )", null);

In the above returned DataSet we have a filed called "CategoryCount" which is the number of items assigned to the that category. Is there a way through API to get the count of categories for just "CMS.Blogpost" Document ?

Please let me know if there is way ?




User avatar
Member
Member
kentico_alleng - 12/29/2012 8:14:15 PM
   
RE:Question on getting category Count
Hello,

The closest method I know of can check the categories for a particular document.

The method in CategoryInfoProvider is:

GetDocumentCategories

And takes these parameters:

documentID (Int32)
ID of the document categories are related to.
where (String)
Where condition to filter returned categories.
orderBy (String)
Order by expression to sort the returned categories.
topN (Int32)
Select top n records
columns (String)
List of columns to select

Regards,

Allen