如何选择属于在一个晔分类库项目 [英] How to select library items that belong to a taxonomy in Ektron

查看:175
本文介绍了如何选择属于在一个晔分类库项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CMS晔8.5版SP2。

I'm using Ektron CMS version 8.5 SP2.

我有一个分类的一些项目。有些是实际的页面,有些是库项目。(如Word文件和PDF文件)

I have some items in a taxonomy. Some are actual pages, some are library items (documents like Word files and PDFs).

比方说,有3页,并在我的分类一共有5个项目2库项目。

Let's say there are 3 pages and 2 library items for a total of 5 items in my taxonomy.

我用下面的code ...

I use the following code...

ContentManager cManager = new Ektron.Cms.Framework.Content.ContentManager();
Ektron.Cms.Content.ContentTaxonomyCriteria ctCriteria = new    Ektron.Cms.Content.ContentTaxonomyCriteria();
ctCriteria.AddFilter(1707, true); // hard coded taxonomy ID
List<ContentData> list = cManager.GetList(ctCriteria);
Label1.Text = list.Count.ToString();

在此code运行时,项目的列表中的计数为3。如果我输出的实际列表,我可以看到它只有在分类页面,而不是2库项目。

When this code runs, the count of items in the list is 3. If I output the actual list, I can see it's only the pages in the taxonomy, not the 2 library items.

看来这ContentManager.getList()函数没有得到库项目,即使这些项目已被添加到该分类。我可以证实,在管理工作区,图书馆项目在分类学可见。

It seems that the ContentManager.getList() function does not get library items, even when those items have been added to the taxonomy. I can confirm that in the admin workarea, the library items are visible in the taxonomy.

有关澄清,这是一个问题的检索的那些已经被添加到分类项目。

For clarification, this is a problem with retrieving items that have already been added to the taxonomy.

有谁知道我怎么能retirieve列表的所有的一个分类项目,包括在没有任何库中的项目。

Does anyone know how I can retirieve a list of all items in a taxonomy, including any library items in there.

请注意:如果我将文件添加到文件系统枭雄,而不是图书馆,它完美的作品。但是在直播系统,我有数百个在库项目,我希望孤单的方式通过分类查看它们,而无需将它们都移动到DMS。

Note: If I add the files to the Document Managment System instead of the library, it works perfectly. But in the live system, I have hundreds of items in the library and I'm hoping theres' a way to view them via a taxonomy without having to move them all into the DMS.

我已经张贴在晔开发商论坛这个问题为好,但我已经没有回答。我希望有人在这里可以提供帮助。

I have posted this question on the Ektron developers forum as well, but I've had no reply. I'm hoping somebody here can help.

干杯。

推荐答案

一个跟进我从那天上@ nedlud的回答评论,我觉得这虽然值得自己的答案。

A follow up to my comment from the other day on @nedlud's answer, I felt like this deserved its own answer though.

按照框架API文档

如果意图是检索已在分类法被归类CMS项目,使用 TaxonomyItemManager

If intent is to retrieve CMS items that have been categorized in Taxonomies, use TaxonomyItemManager.

但作为已经在评论中指出的那样, TaxonomyItemData 对象不受此API返回有一些空的属性,如的QuickLink HTML 。我发现,使用 TaxonomyManager ,可以成功地查询分配给特定分类类别的项目。

But as already noted in the comments, the TaxonomyItemData objects returned by this API have a number of empty properties such as QuickLink and Html. I've found that using the TaxonomyManager, one can successfully query for items assigned to particular taxonomy categories.

下面是一个使用框架API的简短片段(版本> = 8.5);这种感觉让​​人联想到与旧工作(版本&​​LT; = 8.0)分类标准的API,其中一个将创建一个 TaxonomyRequest 和获取封装,不仅分类iteself对象结构回来,但项目分为这种分类:

Here's a brief snippet using the Framework API (version >= 8.5); this feels reminiscent of working with the older (version <= 8.0) taxonomy API wherein one would create a TaxonomyRequest and get an object structure back that encapsulated not only the taxonomy iteself, but the items categorized into that taxonomy:

//e.g. for a single-level taxonomy

long taxRoot = 1707; //from OP's question
TaxonomyManager taxManager = new TaxonomyManager();
//GetTree overload supplying includeItems parameter
TaxonomyData taxTree = taxManager.GetTree(taxRoot, includeItems: true);

foreach(TaxonomyItemData taxItem in taxTree.TaxonomyItems)
{
    //these should print true
    Response.Write(!String.IsNullOrEmpty(taxItem.QuickLink));
    Response.Write(!String.IsNullOrEmpty(taxItem.Html));
}

我目前正在重构了一些8.0版code到8.6版本,并转换为框架API。直到晔修复了(错误?) TaxonomyItemManager 的返回 TaxonomyItemData 与空的属性,我就用上面的方法+ LINQ 的排序/过滤/等。

I'm currently refactoring some version 8.0 code into version 8.6 and converting to the Framework API. Until Ektron fixes the (bug?) of TaxonomyItemManager returning TaxonomyItemData with null properties, I'll be using the above method + LINQ for the sorting/filtering/etc.

这篇关于如何选择属于在一个晔分类库项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆