Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all metadata schemas of a publication

I am quite new to Tridion core service so this might be a simple question. I want to get all metadata schemas by passing a publication ID. If some one has ever done this please reply.

Thanks in advance

like image 757
SDL Developer Avatar asked Aug 23 '12 12:08

SDL Developer


1 Answers

Okay, 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);
    }
}
like image 91
Peter Kjaer Avatar answered Sep 27 '22 19:09

Peter Kjaer