Aktualizacja komponentów przy użyciu usługi podstawowej w SDL Tridion 2011
Aktualizuję komponent za pomocą usługi podstawowej w Tridion 2011.
Przykładowy kod jest następujący,
<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>
Otrzymuję następujący wyjątek:
<code> Unable to save compSequence contains no elements </code>
Detale:
first
- nazwa pola w komponencie
Czy ktoś może pomóc w tym zakresie?
Dziękuję Ci