5

When I try to save a component using core service, the request works, but on the dashboard I find this :

enter image description here

And then, I have to save the component to be sure.

Here is the code I use :

using (var tridion = new CoreServiceAgent())
        {
            componentToCreate = tridion.Client.GetDefaultData(ItemType.Component, ConfigurationContainerId) as ComponentData;
            componentToCreate.Title = itemNumber.ToString();
            componentToCreate.Schema = new LinkToSchemaData { IdRef = "tcm:179-277976-8" };

            schemaFields = tridion.Client.ReadSchemaFields("tcm:174-277976-8", true, new ReadOptions());

            Fields fields = new Fields(schemaFields, schemaFields.Fields, componentToCreate.Content, "Configuration");
            
            fields["Slogan"].AddValue(args.Settings.Slogan);

            componentToCreate.Content = fields.OuterXml;
            tridion.Client.Save(componentToCreate, new ReadOptions());
        }

CoreServiceAgent is a sort of "Facade" to the CoreServiceAgent.

Any help is welcome, thanks in advance

1 Answer 1

6

This happens because when you Save you are only creating a minor version of the component. If you call tridion.Client.CheckIn then you'll have a major version and it won't show like that (and it won't be checked out).

Even better, you could use the tridion.Client.Create method, which will save and checkin the new item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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