Updating the Multimedia Component Metadata XML with Core Service

May 24th, 2018 | Posted by Robert Curlette in Tridion | Tridion Core Service

During a recent DXA project we experienced strange errors when publishing some content.  We are moving to DXA and the new DXA templates try to render every field of the Component and linked-to Components.  This is usually great, but if your content is a bit stale or outdated, or possibly contains an invalid value (like mine did) then the following script might be helpful.  (You should create a normal Core Service app, mine is a Console App, and reference all the usual Tridion Assemblies).

It was complaining that a Category did not contain the Keyword.  The error message was ‘Keyword with title ‘Long Lost Keyword’ does not exist in Category ‘Amazing Category’ [tcm:7-12345-512].’ After some digging we found a Multimedia Component with invalid Metadata.   To view the invalid Metadata we used the excellent Tridion Alchemy Plugin Show Item XML from the team at Content Bloom.  If you haven’t yet tried Alchemy yet, now is the perfect time, and this plugin alone makes it worth the (free) install.  You can even just install it on your Dev server if you want.

The simple solution for our invalid metadata problem would be to change it in the GUI, but the GUI didn’t show the value, and we were stuck.  So, we decided to write a small Core Service script that updates the Metadata field or Removes it.  Hope this helps.

 

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *