2

I'm using SDL Tridion version 2013. Can anyone provide sample code to pull page metadata contents using CoreService?

3
  • There's no 2012 version. Please be more specific in what you want to do. Do you want to read page metadata? If so, through which interface - CoreService, or TOM.NET? Jul 23, 2013 at 13:59
  • Apologies. ver 2013. Using CoreService.
    – Rick
    Jul 23, 2013 at 14:31
  • 3
    @Rick, welcome to the Tridion community. Please have a look at tridion.stackexchange.com/help/how-to-ask. It is customary to demonstrate your effort in researching the answer. Once you do that many of us will be happy to help. Jul 23, 2013 at 14:32

3 Answers 3

11

Assuming you are using Tridion 2011/2013, Page Metadata can be read in several ways.

  1. Templates

    @@Page.Metadata.field@@ (Dreamweaver Syntax)

    ItemFields metaFields = new ItemFields(page.Metadata, page.MetadataSchema); (TOM.Net)

  2. Event System

    ItemFields metaFields = new ItemFields(page.Metadata, page.MetadataSchema); (TOM.Net)

  3. Core Services

    PageData page = channel.Read(pageId, new ReadOptions());
    XElement xMetadata = XElement.Parse(page.Metadata);

  4. Content Delivery

    PageMetaFactory metaFactory = new PageMetaFactory(publicationId);
    IPageMeta pageMeta = metaFactory.GetMetaByUrl(pageUrl);
    CustomMeta customMeta = pageMeta.CustomMeta;

5
1

If you are using Razor Mediator, this can be done fairly easily. I'd created a "debugging TBB" in razor that goes over most all of the properties accessible to you from Razor. If you were looking for a hard example with razor, it'd just be @Page.Metadata.

If you aren't using Razor mediator, then I'd like to encourage you to start - simply because it makes a task like this very simple. If for some reason you can't, I'd defer you to the .net-based answers.

-1

first, there is no Tridion version 2012, i think you are talking about 2011 SP1? and you can read page metadata from CoreService and TOM.NET, depending how you want to implement the third party application. let me know if you have more questions.

2
  • Apologies. ver 2013. Using CoreService.
    – Rick
    Jul 23, 2013 at 14:32
  • ok, no problem, for 2013 you can use Coreservice, which is preferred method for integrate your third party application. for coreservice reference: sdllivecontent.sdl.com if i am correct give me some score :)
    – Lucas Liu
    Jul 23, 2013 at 14:35

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.