Question

I should loop trough all my components and change certain fields' content. Everything is going fine until I encounter on embedded filed. I do not know how to get values from embedded filed, check embedded filed type, change value and save. I can access the embedded fields by using TOM.NET API, but in that case I cannot save my component. If I understood well TOM.NET API is "read only" - no changing is allowed.

Please Help ! Thanks, Milos

Was it helpful?

Solution

I found the solution. This is the peace of code which loop trough the all embedded fields:

public void loopFileds(ItemField field)
if(field.FieldType.Equals(Tridion.ContentManager.Interop.TDSDefines.EnumTridionWebSchemaFieldType.FieldTypeEmbed))
            {
            ItemFields embeddedFileds = field.value[1] as ItemFields;
            if (embeddedFileds != null)
                {
                foreach (ItemField item in embeddedFileds)
                    {
                       // recursive call to pass through all embedded fields with the custom depth
                       loopFileds(item);
                    }
                }

            }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top