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

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);
    }
}

I will suggest you to look sample code from [here][1](Login required) and try your self 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 ids from above xml and check whether it is metadata schema.


Need Your Help

Styling WPF controls inline with Infragistics themes

wpf wpf-controls styles infragistics

we are using Infragistics WPF controls (e.g. xamDataGrid, xamDockManager etc), and we will be using the Infragistics Office 2007 Blue theme which these controls support.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.