1

I need to write an application which requires me to get all keywords out of a given component.

So if I have following schema:

text_field_1 : KeywordFieldDefinitionData, Category (tcm:x-y-z, CATEGORY1)
text_field_2 : KeywordFieldDefinitionData, Category (tcm:a-b-c, CATEGORY2)
random_field_random: .. .. (does not matter)

When I have a Component for the given schema

text_field_1 : Antwerpen : tcm:e-b-c
text_field_2 : Hasselt : tcm:f-g-h
random_field_random: asdasasd

I need to convert this to:

[
   {
       Id: tcm:e-b-c,
       Value: Antwerpen,
       Category: CATEGORY1
   },
   {
       Id: tcm:f-g-h,
       Value: Hasselt,
       Category: CATEGORY2
   },
]

To do this I need the Tcm value of the keyword that is chosen in the fields. But when I look at the xml document from the component (through Core Service) I see the field as:

<text_field_1 xmlns=\"uuid:37a7a47f-88c8-44f7-a6e8-5900ae9f985e\">Antwerpen</text_field_1>

Is there a way to get the keyword Id without going through all keywords within the given Category?

BTW: If I look at the Content Xml through Anguilla I see following Field Value:

<text_field_1 xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="tcm:e-b-c" xlink:title="Antwerpen">Antwerpen</text_field_1>
3

You need to read your component with correct LoadFlags, namely LoadFlags.KeywordXlinks. See: http://amarchuk.blogspot.nl/2012/10/coreservice-and-readoptions.html or Getting additional keyword information from item Xml?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.