I am using Tom API in SDL Tridion 5.3. I am getting list of components using GetItems
method of interface Tridion.ContentManager.Interop.TDS
. I need to get the publication targets from which a component is published.
I can get the similar for pages, as shown in below function:
public static Dictionary<string, string> GetFolderPublishedPages(string foldername, TDSE tdse, ItemType type, string[] publishedTo = null, string[] notPublishedTo = null)
{
Dictionary<string, string> pagelist = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
VirtualFolder fldr = null;
string componentName = string.Empty;
try
{
fldr = (VirtualFolder)tdse.GetObject(foldername, EnumOpenMode.OpenModeEdit, null, XMLReadFilter.XMLReadNull);
foreach (Page lObjPage in fldr.GetItems(ItemType.ItemTypePage))
{
foreach (string targetURI in publishedTo)
{
if (lObjPage.IsPublishedTo(targetURI))
{
foreach (string noTargetURI in notPublishedTo)
{
if (!lObjPage.IsPublishedTo(noTargetURI))
{
pagelist.Add(lObjPage.Title, lObjPage.ID);
}
}
}
}
}
}
catch (Exception ex)
{
}
finally
{
ReleaseComObject(fldr);
}
return pagelist;
}
Please suggest similarly if I can do a check for component too..
Thanks in advance..