【问题标题】:"Unexpected list type" exception when invoking ISessionAwareCoreService.GetList()调用 ISessionAwareCoreService.GetList() 时出现“意外的列表类型”异常
【发布时间】:2012-05-11 00:22:13
【问题描述】:

我正在通过随附的客户端程序集调用 Tridion 2011 SP1 核心服务。当我尝试列出出版物的内容时,我得到了一个例外。

代码(简化)如下所示:

ItemsFilterData filter = new Tridion.ContentManager.CoreService
                     .Client.RepositoryItemsFilterData.RepositoryItemsFilterData();
filter.ItemTypes = new ItemType[] { 
    ItemType.Folder, 
    ItemType.StructureGroup 
};
filter.Recursive = false;                        

IEnumerable<IdentifiableObjectData> childItems = core.GetList("tcm:0-15-1", filter);

注意:变量“core”指的是我可以成功调用的 ISessionAwareCoreService,例如 core.GetSystemWideList()

当 .GetList 被调用时,我得到以下异常:

System.ServiceModel.FaultException`1 was unhandled
  Message=Unexpected list type: 
     Tridion.ContentManager.Data.ContentManagement.RepositoryItemsFilterData.

这个问题的可能原因是什么?你能提出一个很好的通用方法来解释这种信息吗?

【问题讨论】:

    标签: tridion


    【解决方案1】:

    您无法使用GetList 获取Publication 的直接子代。相反,您应该只用client.Read 加载PublicationData,然后访问RootFolderRootStructureGroup

    PublicationData pub = (PublicationData)core.Read("tcm:0-1-1", new ReadOptions());
    string rootFolder = pub.RootFolder.IdRef;
    string rootSG = pub.RootStructureGroup.IdRef;
    

    或者,您可以使用您的RepositoryItemsFilterData 调用GetListXml,然后自己从 XML 中提取项目。

    XElement listResult = core.GetListXml(parent.ID, filter);
    

    【讨论】:

      猜你喜欢
      • 2018-12-06
      • 2011-09-03
      • 1970-01-01
      • 1970-01-01
      • 2021-11-03
      • 2015-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多