It does not appear that the OTA API has a specific property or method to grant access to the ID of the current project, and I'm wanting to get this information in the ALM workflow. For example, the TDConnection object has a ProjectName property, but it does not have a ProjectID property.
Does anyone have a suggestion on how to get this information?
Answer by Young Steve · Jun 01, 2012 at 05:14 PM
Have you tried the GetAllVisibleProjectDescriptors and ProjectDescriptor objects?
GetAllVisibleProjectDescriptors: The list of project descriptors under all domains that the current logged in user is allowed to connect to.
ProjectDescriptor: Get a reference from the list returned by TDConnection.GetAllVisibleProjectDescriptors. The ProjectDescriptor.UId property returns the project's Unique ID number.
ProjectDescriptor seems to have a Uid property. According to the API Reference - "Returns the project's Unique ID number."
If this doesn't work out for you, you could always set up an ODBC connection inside of workflow and query it from qcsiteadmin_db. This would be insecure though as you would have to pass db login info in workflow.
Answer by gopherr · Jun 08, 2012 at 11:22 AM
Thanks, Young Steve. Somehow, I was not putting those pieces together even though I did run across the GetAllVisibleProjectDescriptors method.
So, something like the following should work (I haven't tested it, because I found a workaround):
Dim projectID Set visProjectsList = TDConnection.GetAllVisibleProjectDescriptors For Each projDescr In visProjectsList If projDescr.Name = TDConnection.ProjectName Then projectID = projDescr.UId Exit For End If Next