0

I need to generate the published path of Structure Groups and compare them. I am not able to find any function for the same in TOM API for VBScript.

I am using objSG.Directory, but that gives me only the immediate directory. How can I get the full published path of a structure group?

Function GetDirectoryPath(objSG)
    path = ""
    Do
        path = path + objSG.Directory
        objSG = objSG.OrganizationalItem
    Loop Until objSG.Directory <> "/"
    GetDirectoryPath = path
End Function
  • The full publish path is built from the individual structure groups. You have to walk over entire tree up until publication to get this data – Andrey Marchuk Jun 5 '15 at 13:59
  • Thanks for the quick reply Andrey."walk up the entire tree"...could you please help there?? Do I have any functions that I can use from the API?? – user1555 Jun 5 '15 at 14:06
1

You can recursively call objSG.OrganizationalItem, till it no longer returns a Structure Group, but a Publication (then you know you have reached the top).

You will have to build the path via this (expensive) method yourself, so you might want to consider rewriting the entire function in a TBB using the TOM.NET API. You still have to do the same process, but it is less expensive due to lazy loading on the TOM.NET API.

| improve this answer | |
0

Here is the pseudocode:

// initial item   
path = organizationalItem.title;  
 // Stop traversing up when parent is publication  
while (!organizationalItem.IsRootOrganizationalItem)  
// this takes one level up to the containing organizational item
organizationalItem = organizationalItem.OrganizationalItem;  
path = organizationalItem.title + '/' +  path; 
| improve this answer | |
  • Thanks for the solution Vipin. But, I am not able to find any equivalent function in TOM API to check for Root like IsRootOrganizationalItem that you have used here. – user1555 Jun 8 '15 at 5:53
  • Which version of Tridion are you using? – Vipin Kothari Jun 8 '15 at 6:19
  • The version of Tridion is 2011 sp1 – user1555 Jun 8 '15 at 6:27
  • In 2011 there is TOM .Net API available. The code I've given is for TOM .Net API. Also, do note that Tridion has deprecated TOM API, so you should use TOM .Net API – Vipin Kothari Jun 8 '15 at 6:31
  • Yes, but I have an existing script in VB that uses the TOM API and I urgently need to add a condition to the same that compares the published paths of items. If I use TOM.NET API I will have to rewrite the whole script. – user1555 Jun 8 '15 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.