Skip to content

Instantly share code, notes, and snippets.

@sshibani
Last active August 29, 2015 14:07
Show Gist options
  • Save sshibani/9b338deae6c0d1ec0ec1 to your computer and use it in GitHub Desktop.
Save sshibani/9b338deae6c0d1ec0ec1 to your computer and use it in GitHub Desktop.
Tridion extension methods for Tridion TOM.Net API. available as Nuget Package: https://www.nuget.org/packages/tridion-extensions-coreservice/ Source: https://bitbucket.org/sshibani/tridion.extensions
var client = Wrapper.GetCoreServiceWsHttpInstance(cmsurl, username, password, domain, CoreServiceInstance.Tridion2011);
Console.WriteLine(client.GetApiVersion());
// retrieve a component linked from a component
ComponentData comp = "tcm:5-18".ToTcmUri().GetItem<ComponentData>().GetFieldAsComponent("linkedComponent");
//retrieve a xml representation list of the items within the forlder and its childern
XElement el = "tcm:5-55-2".ToTcmUri().GetListXml(true);
// retrieve field as string from the content
string value = "tcm:1003-2096".ToTcmUri().GetItem<ComponentData>().GetFieldAsString("Value", ContentType.Content);
// retrieve field as string from the meta content
string value = "tcm:1003-2096".ToTcmUri().GetItem<ComponentData>().GetFieldAsString("Value", ContentType.Metadata);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment