3

I am facing the following error while importing the content. Even after syncing the Schema, the issue still persists.

I am using Content Porter 2009 SP1.

I also came to know that Metadata field has been added recently in export environment. After Schema change the Component XMLs are not updated. If I can update the Components of that Schema that will do I guess.

Error details:
        (TCMDAL::ExecuteRequest:Content Manager returned an error)  
        (Cause=true)  Unable to find http://website/schemas/sdltridion:Metadata.
        (Cause=false)  Unable to save Component (tcm:0-0-0).
        (Callstack)  Request.SaveItem - Component.Save - XMLState.Save -
Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.CreateAndCheckIn(UserContext,String,Boolean) -
Tridion.ContentManager.ContentManagement.VersionedItem.Save() -
Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean) -
Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs) -
Tridion.ContentManager.ContentManagement.Component.OnSaving(SaveEventArgs) -
Tridion.ContentManager.ContentManagement.VersionedItem.OnSaving(SaveEventArgs) -
Tridion.ContentManager.ContentManagement.RepositoryLocalObject.OnSaving(SaveEventArgs) -
Tridion.ContentManager.ContentManagement.Component.ValidateXml() -
Tridion.ContentManager.ContentManagement.RepositoryLocalObject.ValidateXml() -
Tridion.ContentManager.IdentifiableObject.ValidateXml(Schema,XmlElement,Repository) -
Tridion.ContentManager.ContentManagement.Component.AssertValidRootContentElements(XmlSchemaSet,String) -
Tridion.ContentManager.IdentifiableObject.AssertValidRootContentElement(XmlElement,XmlSchemaSet,XmlQualifiedName)
        (TCMDAL::Communications::CheckResponseForErrors)  Errors encountered during check of response
        (TCMDAL::Communications::ExecuteRequest)  Error while executing request
        (TCMDAL::TCMItem:Create)  Error while creating item based on given XML 
  • Did you export and import the schema as well as the component? The error suggests that the component is not valid against the schema that is currently in the target environment. – Quirijn Oct 4 '13 at 12:24
  • Can you perhaps edit your question and add the XML of the Component and the XSD of the Schema you are trying to import? – Bart Koopman Oct 4 '13 at 12:25
  • @Quirjin. I have done schema export and import as well. – Patan Oct 4 '13 at 12:25
  • Did you check whether the Metadata schema has also been imported (or already available) on the target server? – Pankaj Gaur Oct 4 '13 at 12:27
  • 1
    @Patan It seems a straightforward case of unsynchronized components then. Following Jaime's recipe below, or manually opening and closing the components on the source system should solve it. – Quirijn Oct 4 '13 at 13:54
5

It looks like the content you are migrating is not in sync with the Schema it is based on. I would do a where used in the Schema the component is based on and check-out/check-in all the components to sync them up with the latest version of the schema. If you have event system or workflow, I recommend you disable them before going through this process.

If you have a lot of components to synchronize you can use this code snippet:

try
        {
            string schemaUri = "YOUR_SCHEMA_URI";

            //Open the Core Service Session
            this.OpenSession();                
            UsingItemsFilterData filter = new UsingItemsFilterData();
            filter.ItemTypes = new ItemType[] { ItemType.Component };
            filter.IncludedVersions = VersionCondition.OnlyLatestVersions;


            //session is the Core Service Client
            XElement result = session.GetListXml(schemaUri.ToString(), filter);

            foreach (XElement element in result.Elements()) {
                String componentId = element.Attribute("ID").Value;
                ComponentData c = session.Read(componentId, new ReadOptions()) as ComponentData;
                if (!c.LockInfo.LockType.Value.HasFlag(LockType.CheckedOut))
                {
                    session.CheckOut(componentId, true, new ReadOptions());                        
                }
                session.CheckIn(componentId, new ReadOptions());
            }



        }
        catch (Exception Exception)
        {
            Console.Write(Exception.Message);
        }
        finally {
            //Close the Core Service Session               
            this.CloseSession();
        }

By checking out/in the Components you are kind of synchronizing them, as long as you didn' modified the schema and you added a mandatory field, in which case you'll have to give it a default value when running the process.

  • Thank you for the answer. I am getting syntax error at c.LockInfo.LockType.Value.HasFlag – Patan Oct 4 '13 at 14:14
  • Forgot to mention, this code is 2013... and the referenced assembly for core service is: Tridion.ContentManager.CoreService.Client.dll within the TRIDION_HOME\bin\client folder. – Jaime Santos Alcón Oct 4 '13 at 14:30
  • How much does a check in/out do? Component synchronizing is usually for new fields, field moves, new mandatory fields, and namespace changes. – Alvin Reyes Oct 5 '13 at 20:20
  • Alvin, check out/in, does a check out and then a check in :) So basically it acts like changing something in the component without changing it, meaning that at check in time it will validate with the new schema. So if you removed a field, the check in operation will remove the component xml associated to that field (both content and metadata). However as I mention in my answer, if the schema modification is more intrusive (like adding a mandatory field) you will need: 1 check out, 2 set a value on the field and 3, a check in to "apply" the component xml changes. – Jaime Santos Alcón Oct 7 '13 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.