【问题标题】:Fetch a component by its tcm id using the core services使用核心服务通过其 tcm id 获取组件
【发布时间】:2015-11-29 03:03:23
【问题描述】:

我需要使用核心服务根据其 tcm id 获取组件。如果可能的话,请帮助我可以使用核心服务的哪个功能以及一些示例代码。

提前致谢!!

【问题讨论】:

  • Tridion 有自己的 StackExchange:tridion.stackexchange.com。尽管这个特定的问题可能不在那里,但那里还有很多关于 Coreservice 的其他有用的问题

标签: tridion


【解决方案1】:

查看文档中的部分,您可以找到here

一个基本样本(出自我的脑海,未经测试;)):

ComponentData component = (ComponentData)client.Read(yourComponentId, new ReadOptions());
string title = component.Title;
XElement content = XElement.Parse(component.Content);

Read 方法将为您提供一个 IdentifiableObjectData 对象,如果您确定应该返回什么,您可以将其转换为所需的类型。 ReadOptions 对象将指示 CoreService 如何加载项目,例如,使用 LoadFlags.KeywordXlinks 加载所有关键字 URI

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-01
    • 2012-07-19
    • 2012-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多