Kevin Brydon
Kevin Brydon

Reputation: 13102

Getting component fields without having to query the underlying XML

Using the Core Service API, is there any way to retrieve the fields of a component without having to resort to querying the underlying XML or using a third party(?) wrapper class?

It's fairly simple when using the TOM.NET API

Tridion.ContentManager.ContentManagement.Component component = [get a component];
var componentFields = new Tridion.ContentManager.ContentManagement.Fields.ItemFields(component.Content, component.Schema);
var summary = ((Tridion.ContentManager.ContentManagement.Fields.TextField)componentFields["summary"]).Value;

But when I start using the Core Service API it seems a little more complicated as there is no Tridion.ContentManager.ContentManagement.Fields.ItemFields class to wrap around the component.Content.

I understand Frank van Puffelen has written a set of classes to implement this wrapper functionality but I am a bit wary of using code that is not officially supported by SDL (or is it?).

At the moment it seems to me the functionality to gracefully retrieve fields from a component using the Core Service API has not been fully implemented. I hope I will be proved wrong!

Upvotes: 1

Views: 728

Answers (2)

Puntero
Puntero

Reputation: 2310

If you are looking for an official wrapper to access the ComponentData content, there is not such a thing as that.

Frank's classes are not officially supported, it is open source code(under the MIT License), but it is built using a supported API, so you should be ok using it.

On the other hand it is not such an extensive piece of code, so if you have an issue, you can probably try to solve it yourself. As already other fellow developers did, as you can see on the page comments.

Upvotes: 4

Quirijn
Quirijn

Reputation: 3548

This question has been asked before, more than once actually.. For example: How to set content to a component without loading XML in SDL Tridion using core services?.

Upvotes: 3

Related Questions