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
2
  • 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 Jun 5, 2015 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, 2015 at 14:06

2 Answers 2

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.

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; 
5
  • 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, 2015 at 5:53
  • Which version of Tridion are you using? Jun 8, 2015 at 6:19
  • The version of Tridion is 2011 sp1
    – user1555
    Jun 8, 2015 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 Jun 8, 2015 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, 2015 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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