I've changed the Element Root Name of my Schemas and now I want to synchronize my components with their new Root elements.
I'm trying to do it with the CoreService.SynchronizeWithSchemaAndUpdate method. Defining Flags like this:
SynchronizeOptions options = new SynchronizeOptions();
options.SynchronizeFlags = Tridion.ContentManager.CoreService.Client.SynchronizeFlags.FixNamespace;
options.SynchronizeFlags = Tridion.ContentManager.CoreService.Client.SynchronizeFlags.RemoveUnknownFields;
options.SynchronizeFlags = Tridion.ContentManager.CoreService.Client.SynchronizeFlags.ApplyDefaultValuesForMissingMandatoryFields;
And calling:
CoreService.SynchronizeWithSchemaAndUpdate(comp.Id, options);
But it crash giving me this exception:
Unexpected root element: Content. Expected:uuid:fe3b0600-5bfd-4224-b9ef-63c99bbb854e:MiceHPContent.
In this case, old Element Root Name was "Content" and I've changed it for "MiceHPContent". The SynchronizeFlags.FixNamespace flag it shouldn't to fix this problem precisely?
If the namespace of the content item's root element is not the same as the Schema's, it is set to the Schema's.
How can I synchronize the components?
Thank you.
SynchronizeWithSchema
, that might work. This takes anIdentifiableObjectData
object instead of an ID and doesn't save the changes.