Aktualisieren von Komponenten mit dem Core Service in SDL Tridion 2011
Ich aktualisiere eine Komponente mit Core Service in Tridion 2011.
Der Beispielcode lautet wie folgt:
<code>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); </code>
Ich erhalte folgende Ausnahme:
<code> Unable to save compSequence contains no elements </code>
Einzelheiten:
first
- Name des Feldes in der Komponente
Kann mir jemand dabei helfen?
Vielen Dank