I have schema A that has the field called Keys which is embedded schema type. The embedded schema consists of 2 fields that is the keyname and keyvalue. I have created component using schema A. After that I created parameter schema and gave the componentpath in the field such that I can access the component path. That parameter schema assigned to the TBB.

Now I want to read the component path and want to read for the particular keyname this is the keyvalue using C# TBB.

1 Answer 1


The text below is OK - but irrelevant to the actual question. To read the parameter of a TBB, simply use this:

string value = package.GetValue("FieldName");

Where "FieldName" is the (XML) name of the field of the parameter schema.

This is relatively simple to do...

You need to first load an instance of the EmbeddedSchemaField, then read it's child nodes. It's very easy to visualize if you look at the XML of the component:

  <Field>Some value</Field>

In c# you'd write something along these lines:

ItemFields content = new ItemFields(component.Content, Component.Schema);
ItemField embeddedField = (ItemFields)content["EmbeddedField"];;
TextField textField = embeddedField["Key"];
String textFieldValue = textField.Value;

Or even simpler if you happen to have the DGX installed.


If you know the key name, and want to find the corresponding value, I'd probably use something like a KeyValuePair or a simple Dictionary(String,String), load the various key/value pairs into it the first time you try to load a value, then use simple String value = dictionary[key] in my code.

  • I see - you know the key, and want the corresponding value? Might be simpler to do with XML actually...
    – Nuno Linhares
    Commented Aug 25, 2014 at 8:22
  • @ Nuno linhares sorry the question which i have asked above is not clear. I have created parameter schema that has the field component path, this parameter schema assigned to the tbb. while creating a page only the component is attached with it's particluar ct but it will not come to know from which component rendering the key name and key value in that case assigned the parameterschema to the tbb. Now first i want to read the component path from the parameter schema, create object of it and latrer want to read the keyname and keyvalue in C#
    – k951
    Commented Aug 25, 2014 at 8:26
  • Oh - getting the value from the Parameter schema? That's an easy one, it should be available in the package... let me check.
    – Nuno Linhares
    Commented Aug 25, 2014 at 8:33
  • 2
    package.getValue('keyname')? Commented Aug 25, 2014 at 13:33

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.