Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Getting the documents of a category View modes: 
User avatar
Member
Member
beau.cowan-rrpartners - 4/16/2013 5:51:41 PM
   
Getting the documents of a category
I'm trying to get the documents of a category for a current project my client asked for. I think that I'm close, but I'm not totally sure. Here is the current code that I'm using for it:

CMS.SiteProvider.CategoryInfo category = CMS.SiteProvider.CategoryInfoProvider.GetCategoryInfo("Environment", CMS.CMSHelper.CMSContext.CurrentSite.ToString());

string docs = CMS.SiteProvider.CategoryInfoProvider.GetCategoryDocumentsWhereCondition(category, true);


I have about 3 documents in the Environment category, but I still don't get any information returned. I would just like to make sure that I'm doing this correctly.

User avatar
Member
Member
beau.cowan-rrpartners - 4/16/2013 6:49:11 PM
   
RE:Getting the documents of a category
found my error, I wasn't using the sitename correctly. Sorry about that.

User avatar
Member
Member
davids-kentico - 4/17/2013 5:31:13 AM
   
RE:Getting the documents of a category
Was this the problem: CMS.CMSHelper.CMSContext.CurrentSite.ToString()

To get the name of the current site, use

CMS.CMSHelper.CMSContext.CurrentSiteName

It saves some processing time.

User avatar
Member
Member
beau.cowan-rrpartners - 4/17/2013 3:14:29 PM
   
RE:Getting the documents of a category
Yes, that was the problem. Once I realized that I was able to figure out the rest.

Thank you for your time.