I am trying retrieve a list of Normal and Multimedia Schemas from a given Publication context. So far I have:

RepositoryItemsFilter filter = new RepositoryItemsFilter(engine.GetSession());
filter.ItemTypes = new ItemType[] { ItemType.Schema };
filter.Recursive = true;

Publication pub = this.GetPublication();
foreach (Schema schema in pub.GetItems(filter))
    //need to further refine to only use Normal and MM schemas

This is usually not a problem when we are working with a Component because we just do ComponentType.Normal or ComponentType.Multimedia. But how do we do this if we only have a Schema?


You can get the schema.Purpose which gives you an enum (SchemaPurpose) this gives you access to all the schema types including:

  • Component
  • Multimedia
  • Embedded
  • Metadata
  • Protocol
  • TemplateParameters
  • UnknownByClient
  • VirtualFolderType
  • 1
    Taking that one step further, there is actually a SchemaPurposes property on the filter that you can use to only get the types of Schemas you are looking for (using this enum). That way, you don't have to do this in a loop after retrieving all Schemas. Jul 10 '13 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.