我正在使用 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);
我收到以下异常:
Unable to save compSequence contains no elements
细节:
first
- 组件中的字段名称
有人可以帮忙吗?
谢谢