使用核心服务通过 tcm id 获取组件

Fetch a component by its tcm id using the core services

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

提前致谢!!

查看文档中的部分,您可以找到 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