我正在使用Tridion 2011中的核心服务更新组件.
示例代码如下,
string COMPONENT_URI = "tcm:8-674";
string SCHEMA_URI = "tcm:8-426-8";
ComponentData component = client.TryCheckOut(COMPONENT_URI, null) as ComponentData;
try
{
Response.Write("<BR>" + component.Content);
XDocument xdoc = XDocument.Parse(component.Content);
var element = xdoc.Elements("first").Single();
element.Value = "updated";
xdoc.Save(component.Content);
client.Save(component, null);
Response.Write("<BR"+"SAVED");
}
catch (Exception ex)
{
Response.Write("Unable to save comp" + ex.Message);
}
client.CheckIn(COMPONENT_URI, null);
Run Code Online (Sandbox Code Playgroud)
我得到以下异常:
Unable to save compSequence contains no elements
Run Code Online (Sandbox Code Playgroud)
细节:
first - 组件中字段的名称
对此有任何帮助吗?
谢谢
tridion ×1