I'm looking for information on how to create and publish dynamically components in Tridion 2009.
What kind of API do I need and are there any tutorials around to get started with it?
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI'm looking for information on how to create and publish dynamically components in Tridion 2009.
What kind of API do I need and are there any tutorials around to get started with it?
The TOM.NET API in 2009 was read-only, so your only option is the TOM API, and for .NET code, you can use the TOM Interop DLLs.
You will need to reference Tridion.ContentManager.Interop.cm_tom.dll
and Tridion.ContentManager.Interop.cm_defines.dll
(found in the [Tridion]\bin\client\PIA
folder on your CMS)
Then you can use the TOM API in your .NET code (check out the TOM API guide for details on creating new items):
using Tridion.ContentManager.Interop.TDS;
using Tridion.ContentManager.Interop.TDSDefines;
TDSE tdse = new TDSE();
tdse.Impersonate(@"domain\user");
tdse.Initialize();
Page page = (Page)tdse.GetObject("tcm:1-2-64", EnumOpenMode.OpenModeEdit, Constants.URINULL, XMLReadFilter.XMLReadData);
page.Title = "new title";
page.Save(true);
ReleaseCom(page);
ReleaseCom(tdse);
private static void ReleaseCom(object instance)
{
if (instance != null)
{
try
{
Marshal.ReleaseComObject(instance);
}
catch
{
// log potential memory leak
}
}
}
Please note the usage of Marshal.ReleaseComObject
on every object you use, since this is Com Interop code, and you need to properly release your objects. There is more written about that in other questions, just search for Marshal.ReleaseComObject
In addition to what Bart said, below is the Link (Login Required) to get the Detailed Documentation for the TOM API:
You need to login with valid SDL account and need to download the Full Documentation ZIP file.