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);
}