Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:48:39+00:00 2026-06-03T11:48:39+00:00

I have a schema in Tridion which have embedded schema fields which may further

  • 0

I have a schema in Tridion which have embedded schema fields which may further have embedded fields in there.

I want to reach final leaf field so that I can assign some value to it. For that I want to write recursive function which loop through each and every field until it reaches a final field.

I am implementing using the Core Service in SDL Tridion 2011

My code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ServiceModel;
using System.Net;
using System.Xml;
using Tridion.ContentManager.CoreService.Client;
using System.Text;
using Tridion.ContentManager.CoreService;
using System.ServiceModel.Channels;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Data.OleDb;
using System.Data;
using System.Configuration;


namespace Loading_Utility
{
    public partial class TST : System.Web.UI.Page
    {
        Fields obj = new Fields();
        protected void Page_Load(object sender, EventArgs e)
        {
            using (ChannelFactory<ISessionAwareCoreService> factory =
            new ChannelFactory<ISessionAwareCoreService>("wsHttp_2011"))
            {
                ISessionAwareCoreService client = factory.CreateChannel();
                var schemaFields = client.ReadSchemaFields("tcm:202-2242-8", true, new ReadOptions());
                ComponentData component = (ComponentData)client.GetDefaultData(ItemType.Component, "tcm:202-638-2");
                var fields = Fields.ForContentOf(schemaFields);
                component.Schema.IdRef="tcm:202-2242-8";
            }
        }
        public void fieldRecursion(Field field)
        {
            //var getFields = fields;
            if (field.GetType() == typeof(EmbeddedSchemaFieldDefinitionData))
            {
                // code for checking further if field is embedded or not


                //Field newField = field.GetSubFields().GetFieldElements( new ItemFieldDefinitionData() as Field)
                //fieldRecursion(recursiveField);
            }
            //string fieldName = recursiveField.Name;
            //fields[fieldName] = "HI";

        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:48:42+00:00Added an answer on June 3, 2026 at 11:48 am

    Whilst I don’t have the solution you are looking for, I see you’re using the core service, personally I prefer to get hold of the Component XML (Component.Content) and parse/manipulate it as I need. Perhaps if you can paste the XML here I can drop it into one of my sample core service projects and send you a solution back?

    In the event that doesn’t help you, i’ve had a look at the api, and this should help you get going in the right path. Perhaps once you have a solution you could paste it here?

    public void RecurseEmbeddedFields(SchemaFieldsData schemaFields)
    {
        foreach (ItemFieldDefinitionData field in schemaFields.Fields)
        {
            if (field.GetType() == typeof(EmbeddedSchemaFieldDefinitionData))
            {
                // check if this field contains more embedded fields
                // if it does recurse
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a schema called application. Is there a way that, rather than using
I have a schema (xsd), and I want to create xml files that conform
I have one schema file that I'm using to generate java files. I want
We have a metadata schema that has 3 fields in it - 2 text
I have a table which have schema like this id name 1 jack 2
I know that I should have schema of a table before calling NewRow method
I have this schema which I need to match 2 rows from user_data :
I have this schema: There is a table for persons. Each person has one
I have a schema that essentially looks like this: CREATE TABLE `data` ( `id`
I have a schema from a third party that I've generated c# objects from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.