8

I want to remove the Metadata Schema from a folder using the core service API. I have tried setting the MetaDataSchema and MetaData properties of the folder to null but this doesn't change anything.

var organizationalItem = (FolderData)client.Read(organizationalItemID, new ReadOptions());
organizationalItem.Metadata = null;
organizationalItem.MetadataSchema = null;
organizationalItem = (FolderData)client.Save(organizationalItem, new ReadOptions());

Any ideas what I am doing wrong?

2
  • How did you ensure that this does not changed anything? Did you check the value of organizationalItem variable at debug mode or you have checked the folder property in CME? If it is later case, check after clearing your cache and restarting the COM+ Commented May 20, 2013 at 14:05
  • @PankajGaur I figured it out, hopefully this will be useful to someone else. Commented May 20, 2013 at 14:09

1 Answer 1

12

Looks like I have to set the MetaDataSchema to an "empty" LinkToSchemaData object instead of null

var organizationalItem = (FolderData)client.Read(organizationalItemID, new ReadOptions());
var emptySchema = new LinkToSchemaData();
emptySchema.IdRef = "tcm:0-0-0";
organizationalItem.MetadataSchema = emptySchema;
organizationalItem = (FolderData)client.Save(organizationalItem, new ReadOptions());
0

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.