1

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!

Kevin Brydon
  • 12,524
  • 8
  • 46
  • 76
  • Great questions, Kevin. Have you had a chance to check out the [Tridion Area 51 Beta proposal](http://area51.stackexchange.com/proposals/38335/tridion?referrer=V2-BIZVA0gmNn9xqeeO2NA2)? We're looking to get more linked profiles to launch a Tridion-specific StackExchange site. – Alvin Reyes Oct 03 '12 at 06:49

2 Answers2

4

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.

Puntero
  • 2,310
  • 15
  • 18
  • I agree that it is not a very extensive piece of code but I would prefer to use something that is officially supported by SDL. Once I'm done upgrading my clients version of Tridion and rewritten their old VB6 code I'll be gone. Any issues with the wrapper will have to be fixed by whoever inherits my code rather than turning to SDL customer support. – Kevin Brydon Sep 27 '12 at 12:42
3

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?.

Community
  • 1
  • 1
Quirijn
  • 3,549
  • 15
  • 30
  • I probably should have mentioned that I have looked at the other two or three similar questions which is where I got the link to Franks wrapper class. I was asking if there was another way other than using a custom wrapper. I had doubts that I was missing something really obvious as it is fair to assume that if the TOM.NET API comes with a nice official wrapper that Core Service would too. – Kevin Brydon Sep 27 '12 at 12:32
  • 1
    Sorry I was a bit harsh then. However, Frank's earlier replies also mentioned that there is no supported way to parse the XML into an object model like the Fields in the .NET api. I agree with you that this is a bit odd. – Quirijn Sep 27 '12 at 13:47