I want to create a Metadata Schema using Core service with two fields Keywords and title so that I can attach this Metadata Schema on the page. But I didn't find any class to create a metadata. I found a class SchemaData to create a Schema and it successfully created a schema but I did not find any method to set the type of this schema. I try to create a schema with the root element Metadata but it is giving me an error.

Invalid value for property 'Purpose'. The content of RootElementName cannot be 'Metadata' for schemas with purpose 'Component.

how can I do this?

1 Answer 1


There is a purpose property in SchemaData class, to define purpose(type) of schema. By default it's set to the value SchemaPurpose.Component. That's why, if you are creating with the root element 'Metadata' its throwing the error.

try like this:

SchemaData scm = new SchemaData();
scm.Purpose = SchemaPurpose.Metadata;

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.