Get all publication metadata schemas

I am new to the main Tridion service, so this might be a simple question. I want to get all metadata schemas by passing the publication identifier. If someone did this, answer.

Thanks in advance

+6
source share
2 answers

Ok, here is an example. GetCoreServiceClient returns a SessionAwareCoreServiceClient with Impersonate already called for the correct user.

public static IdentifiableObjectData[] GetMetadataSchemas(string publicationId) { using (var client = GetCoreServiceClient()) { var filter = new RepositoryItemsFilterData { SchemaPurposes = new[] { SchemaPurpose.Metadata }, Recursive = true, ShowNewItems = false, ItemTypes = new[] { ItemType.Schema } }; return client.GetList(publicationId, filter); } } 
+10
source

I suggest you look at a sample code from [here] [1] (requires login) and try yourself first.

[http://sdllivecontent.sdl.com/LiveContent/content/en-US/SDL_Tridion_2011_SPONE/concept_95D8F90693834AF089FEBCDC0347D04D] [1]

or try this.

 RepositoryItemsFilterData filterData = new RepositoryItemsFilterData(); filterData.ItemTypes = new[] { ItemType.Schema }; filterData.Recursive = true; XElement resultXml = client.GetListXml(publicationId, filterData); 

And then you need to create each schema object after getting the identifiers above xml and check if it is a metadata schema.

+10
source

Source: https://habr.com/ru/post/923553/


All Articles