Archive for January 2011
Custom utility for deploying COM dlls in Tridion
Deploying Tridion COM dlls should be carried out in the following sequences. I believe this is common process for any COM deployment so this utility is not restricted only to Tridion but here I’m specifically talking about Tridion Services.
1) Shut down Tridion Content Manager
2) Copy the dlls into <<Tridion bin location>>
3) Start Tridion Content Manager
We were doing these each actions manually since we are working on remote environment. If you are working on Tridion COM assemblies like tridion event systems, you might need to deploy the dlls frequently during development phase.
This can be done manually but since they are frequent actions, I wanted to automate this process. After few hours of coding I’ve written a custom utility which will perform this deployment activities.
COM Deployer.zip can be downloaded from this link.
It has the following files…
1) COMDeployer.exe
2) COMDeployer.exe.config
3) Interop.COMAdmin.dll
The only place where user should make change is config file.
<appSettings> <!--COM Service Name ex) "Tridion Content Manager" --> <add key="application" value="Tridion Content Manager"/> <!--Server name or IP where COM services are installed --> <add key="server" value="192.168.0.2"/> <!--Source file location (local/remote shared path), including file name & use ; to include multiple files--> <add key="sourceFiles" value="D:\TridionPOC\evntSystem.dll "/> <!--Target file location (local), without file name--> <add key="targetLocation" value="D:\Training"/> </appSettings>Prerequisite:
1) .Net framework 3.0 or higher
2) User must have admin rights
3) Tool must run on Tridion Server
Sad thing is that I developed this utility after we had completed our project
. I’ll share the source code details of this utility later.
Finding IsPublished status in Tridion
Sometimes back we faced a difficulty in identifying whether a component is published or not. I don’t think there is a direct method or property to check its published status. I was expecting something similar to IsPublished property in TOM.Net but I couldn’t find anything like that so one of my teammate found a workaround to check its status. We were sure that we could find this status somewhere in component object. Finally component object has its all details in its xmldata.
XML data has IsPublished node which tells you whether it is published or not. So we have written a below utility method to get you the component’s publish status.
The same can also be applied to other building blocks like page. All you need to do is, replace page instead of component object in below method.
private bool IsPublished(Component component)
{
string xmlData = component.GetXML(XMLReadFilter.XMLReadPublishInfo);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlData);
string isPublished = xmlDoc.SelectSingleNode("//*[local-name()= 'IsPublished']").InnerText;
return Convert.ToBoolean(isPublished);
}
Component.GetXML(XMLReadFilter.XMLReadPublishInfo) -> returns you the below xmldata. Then its all about getting the value of its IsPublished node. That’s it.
<tcm:Component ID="tcm:21-26941" IsEditable="false" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink"> <tcm:Info> <tcm:PublishInfo xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink"> <tcm:IsPublished>false</tcm:IsPublished> </tcm:PublishInfo> </tcm:Info> </tcm:Component>
If you are a .Net developer, you would realize that Tridion 2009 is not so developer friendly. I’m hoping that all these will be resolved in Tridion 2011 version
I would appreciate if anyone suggest better solution
