I am new to Core service. I have a requirement to update metadata schema of a folder( from the drop down) and on successful selection of Metadata schema, I need to update the value for a field(Metadata schema) in the folder and save it.

I am able to fetch the folder and its metadata value using folder.MetadataSchema.IdRef Tried Updating the Metadata schema of the folder using folder.MetadataSchema.IdRef = "Metadata schema’s tcm id"; and I am getting the below error while saving it. client.Save(folder, null);

"unable to find URL/Tridion/schema/folder:Metadata"

Please help me in saving the folder and to update the dependent metadata field.

Code Snippet:

                   var folder = (FolderData)client.Read(tcmid, new ReadOptions());   
                   if (folder.MetadataSchema.IdRef.Equals("tcm:0-0-0"))
                         var Schema = new LinkToSchemaData();
                        Schema.IdRef = "tcm:84-2784-8";
                        folder.Metadata = null;
                        folder.MetadataSchema = Schema;                           
                        client.Save(folder, null);                            
  • Could you add a code snippet of your core service application to indicate exactly what you did and also specify what language that is in? That will make it a lot easier to answer this question. Commented May 21, 2013 at 13:51
  • I have updated the question with the code I have tried. Language : C#, Error : "Unable to find URL/Tridion/Schema/folder:Metadata"
    – User344
    Commented May 22, 2013 at 10:17
  • Does your metadata schema have any required fields? folder.Metadata = null; Commented May 22, 2013 at 16:43

2 Answers 2


Try this:

//For updating a meta data schema of the Folder:

var client = <properly initialized core service client>;
var folder= (FolderData)client.Read(<TCM URI of the Folder>, new ReadOptions());
var new Schema = new LinkToSchemaData();
new Schema.IdRef = <TCM URI of the Schema>;
folder.Metadata = null;
folder.MetadataSchema = newSchema;
client.Save(folder, new ReadOptions());

//For updating a meta data fields:

schemaFields = client.ReadSchemaFields(folder.MetadataSchema.IdRef, true,
fields = Fields.ForMetadataOf(schemaFields, folder);

 // Update Fields Accordingly
  field[<field name>].Value = <new value>;

  //Update the metadata
  folder.Metadata = fields.ToString();
  client.Save(folder, DEFAULT_READ_OPTIONS);

  //Helper Method

  public static Fields ForMetadataOf(SchemaFieldsData _data, 
                                               RepositoryLocalObjectData _item)
      return new Fields(_data, _data.MetadataFields, _item.Metadata, "Metadata");

Also, you can see more information about these great methods HERE

  • Thanks for the reply. Tried the code that you have shared, I am still facing the same issue "Unable to find URL/Tridion/Schema/folder:Metadata". Also, Could you please let me know if this is a custom method'ForMetadataOf'
    – User344
    Commented May 22, 2013 at 10:20
  • Its unfortunate. By the way, the ForMetadataOf is a custom method. I have added the definition of this method my answer along with the link where such useful functions has been shared. Commented May 22, 2013 at 10:46

I think at minimum you have to set folder.Metadata to:

<Metadata xmlns="uuid:<YOUR_VALUE>"></Metadata>

Check that

folder.Metadata = fields.ToString();

Is setting the value correctly.

Try hard-coding the string as a test.

You can find your uuid by opening your schema, and looking at the source tab:

enter image description here

  • I tried this but getting error var newSchema = new LinkToSchemaData(); newSchema.IdRef = "a1ee6c20-8a16-4e92-9265-9defb9bde573"; newFolderData.Metadata = null; newFolderData.MetadataSchema = newSchema;
    – Ali
    Commented Sep 2, 2013 at 5:36
  • It might be best to create a new question for your problem, but this line looks wrong "newSchema.IdRef = "a1ee6c20-8a16-4e92-9265-9defb9bde573";". This should refer to the TCMID of a schema, or blank if you are dynamically creating schemas Commented Sep 4, 2013 at 4:58

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.