Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8083397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:27:27+00:00 2026-06-05T17:27:27+00:00

I am attempting to access values in the Categories and Keywords information for a

  • 0

I am attempting to access values in the Categories and Keywords information for a Tridion Publication via a Razor TBB in Tridion 2011. The Razor documentation lists the following example code:

<ul>
@foreach (var keyword in Publication.MetaData.SomeKeywordFields) {
<li>@keyword.Title (@keyword.Id)</li>
}
</ul>

I have a Keyword inside of a Category though… in fact, that’s the only way I am myself aware that you can even have a Keyword in Tridion, but correct me if I am wrong. Extrapolating from the example’s syntax, I tried the following where “myCategory” is a Category in the publication, and “myKeyword” is a Keyword inside of the myCategory Category:

@foreach (var keyword in Publication.MetaData.myCategory) {
if(@keyword.Title == "myKeyword") {
@keyword.Title
}

When I run this template, I get an error stating that DynamicItemsFields: Key ‘testcategory’ Not Found In ItemFields (Object reference not set to an instance of an object)

Can anyone help with identifying if it is even possible to do what I am attempting here (as it seems like it is based on the documentation but still not sure) and if so, provide an example of the correct syntax?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:27:29+00:00Added an answer on June 5, 2026 at 5:27 pm

    You’re almost there with your code except that you’re using the actual CategoryName. As Puf commented, you have to use the “fieldname” of you Publication Metadata not the actual CategoryName. You should just change the “myCategory” to the actual fieldname

    @foreach (var keyword in Publication.MetaData.*<<FIELDNAME>>*) {
       if(@keyword.Title == "myKeyword") {
            @keyword.Title
       }
    }
    

    [FIELDNAME] –> is the XMLName of publication metadata schema.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to access the HTML of a page after it has been
I am attempting to access elements with a specific class name from a page
I'm attempting to access the raw audio data sent to the Audio Queue callback,
I am attempting to access a queue and receiving an access denied error. The
Am interoping a c++ dll and am attempting to access it's functions. Below is
We have a scenario where some .NET code is attempting to access the current
I'm attempting to create Data Access Layer for my web application. Currently, all datatables
I'm attempting to translate an existing Access report into a client-side SSRS 2008 report,
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt.
I am attempting to access a web service using SOAP through Perl and am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.