Sunday, May 8, 2011

Add Enterprise keywords field into custom content type

In this post I would like to describe how to add OTB Enterprise keywords field into custom content type declaratively. Enterprise keywords – is a standard managed metadata field which is binded to the standard term set in Term store: System > Keywords. It allows users to specify keywords in content metadata, e.g. users can apply some keywords to the document, to the page or to the list item. These keywords will be saved in the Keywords term store and will be available for other users for selection.

You can add Enterprise keywords to the content type via UI (this field is located under Enterprise keywords group). As you probably know when you need to add some managed metadata field to the custom content type declaratively you need to add 2 fields: one for taxonomy field itself and other is hidden field of Note type. In order to add Enterprise keywords into content type declaratively for provisioning you also need to add 2 fields: one is the keywords “TaxKeyword” (id = 23F27201-BEE3-471E-B2E7-B64FD8B7CA38) and another is hidden field “TaxKeywordTaxHTField” (id = 1390A86A-23DA-45F0-8EFE-EF36EDADFB39) for the keywords (both fields has the same predefined id on all Sharepoint installations), You need to use the following code:

   1: <ContentType
   2:     ID="0x..."
   3:     Name="MyContentType"
   4:     Description=""
   5:     Group="MyGroup"
   6:     Inherits="TRUE"
   7:     Version="0">
   8:   <FieldRefs>
   9:     ...
  10:     <FieldRef ID="{1390A86A-23DA-45F0-8EFE-EF36EDADFB39}" Name="TaxKeywordTaxHTField" DisplayName="TaxKeywordTaxHTField" />
  11:     <FieldRef ID="{23F27201-BEE3-471E-B2E7-B64FD8B7CA38}" Name="TaxKeyword" DisplayName="$Resources:osrvcore,field_KeywordsFieldName;" Required="FALSE" />
  12:   </FieldRefs>
  13: </ContentType>

With this code you will be able to use OTB Enterprise keywords field in your content types.

7 comments:

  1. For some reasons field not added to content type on my env. Maybe we need to configure something else?

    ReplyDelete
  2. hi Ec,
    ensure that feature of Site scope TaxonomyFieldAdded is activated on your site collection. Mentioned fields (TaxKeywordTaxHTField and TaxKeyword) are added to the site in feature receiver of this feature.

    ReplyDelete
    Replies
    1. TaxKeywordTaxHTField and TaxKeyword - these feilds re added into the library input form. How we can remove those from the form. any help will be apprciated.

      Delete
    2. https://www.c5insight.com/Resources/Blog/tabid/88/entryid/244/why-do-hidden-taxonomy-catch-all-columns-become-visible.aspx

      Got the resolution to hide internal feilds using powershell.

      Delete
  3. Feature was activated. But fields not active even in that case!

    So i found next solution:
    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/cd781725-d8d8-4e16-80d9-792477681d54/


    Add also some fields:

    ReplyDelete
  4. Hey Dude... I wanted to create that Labels Circle that you have on right...
    When you hower over at that it keep rotating n all... Can you please help me to create the same..

    thanks..
    my email is - kp.9287@gmail.com

    one more thing i need to add entrerprise keywords control to application page on sharepoint 2010 can you please help me on that as well..

    Thanks in Advance.
    KruPesh.

    ReplyDelete
  5. hi KRUPESH PATEL,
    google for "blogumulus". About your second question: there is not enough info. It is better to post your question on http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/threads and provide more details there. I check forums regularly, but it may be so that someone else will answer it quicker.

    ReplyDelete