Using .net I'd like to pull write a class that will pull component information based on the component's tcmid that is passed to id. Could someone point me to documentation or/and samples that could point me in the right direction?
I assume you want to do it via the Core Service: Take a look at these links:
That should give you some material to read.
This sample code will allow you to "read" a component from .net using the Core Service and access some of its data:
String id="tcm:1-1"; //Your component id ComponentData comp = Tridion.Read(id, new ReadOptions()) as ComponentData; FullVersionInfo info = comp.VersionInfo as FullVersionInfo; String creator = info.Creator.Title +" [" + info.Creator.IdRef + "]"; String created = info.CreationDate.Value.ToNiceDate(); String modified = info.RevisionDate.Value.ToNiceDate(); String folderId = comp.LocationInfo.OrganizationalItem.IdRef.ToString(); String folderTitle = comp.LocationInfo.OrganizationalItem.Title; String schemaId = comp.Schema.IdRef.ToString(); String schemaName = comp.Schema.Title;
In regards to Alvin's comment:
If what you need is to get data using the Content Delivery API, you might want to read the answers to this question: Unable to get specific field value from component.
It will explain the "basics" of Content Management vs. Content Delivery contexts. In a nutshell, whatever you need to access in the content delivery, you need to make available in the content delivery, normally by "publishing". When you publish the content gets rendered with templates and they will "produce" the data you want (be it html, xml, json, etc...). Once the data is available in the Broker Database (Content Delivery data store), you can read it using any of the available APIs (.Net, oData).
To read Component content from template side, below is the information
- Firstly you need to get the object
Type cast the object as Component
Component mComponent = mEngine.GetObject(ID) as Component;
To get the component XML
XmlElement componentXml = mComponent.ToXml();
To get the components content only
XmlElement componentContent = mComponent.Content;
To get the components metadata only
XmlElement componentMetadata = mComponent.Metadata;