简体   繁体   中英

Ektron: Getting content by folder ID - get all smartforms in folder?

I'm new to Ektron, and I'm having trouble finding decent documentation on how to get content. I have a folder that contains smartforms. In my code, I need to get all those smartforms. This is all I have so far:

var folderManager = new FolderManager();
var folder = folderManager.GetTree(Convert.ToInt64(ConfigurationManager.AppSettings["AlumniSlideshowFolderId"]));

But from there, I have no idea how to get my data. Please help!

Something like this should do the trick. You'll actually want to use the ContentManager instead of the FolderManager . The criteria object is pretty powerful... you can refine the list down further if you need to.

var contentManager = new ContentManager();
int recordsPerPage;
int.TryParse(ConfigurationManager.AppSettings["AlumniSlideshow.RecordsPerPage"], out recordsPerPage);

int currentPage;
int.TryParse(HttpContext.Current.Request.QueryString["p"], out currentPage);
if (currentPage <= 0)
{
    currentPage = 1;
}

long alumniSlideshowFolderId;
long.TryParse(ConfigurationManager.AppSettings["AlumniSlideshowFolderId"], out alumniSlideshowFolderId);

var criteria = new ContentCriteria();
criteria.AddFilter(ContentProperty.FolderId, CriteriaFilterOperator.EqualTo, alumniSlideshowFolderId);

// By default, the GetList method will use a 'recordsPerPage' value of 50.
criteria.PagingInfo = new PagingInfo(recordsPerPage, currentPage);
var content = contentManager.GetList(criteria);

foreach (var contentData in content)
{
    // work with each result here
}

You also mentioned not finding good documentation. Here are a few links. There is some pretty good documentation available, especially for the newer FrameworkAPI classes. You just have to know where to look.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM