AbhishekJD Absent Member.
Absent Member.

How to add a new folder and subfolder to the QC Resource using OTA



I am trying to add folder and Subfolders in ALM under Resource section using OTA.

I successfully created folder under Resources, but not able to find solution to add sub folders.



Option Explicit

Dim oALMConnection




Function CreateFolderInALMResources()

    Dim sALM, sDomain, sProject, sUserName, sPassword, resRoot, newFolder, testManager, root, subFolder1  

        'Quality Center Project settings

        sALM = ""

        sUserName = "Abhishek"

        sPassword = "Abhishek"

        sDomain = "DEFAULT"

        sProject = "Demo_Training"      



        '// STEP 1: Get the ALM Object and connect to the project 

        Set oALMConnection = CreateObject("TDApiOle80.TDConnection")

        oALMConnection.InitConnectionEx sALM

        oALMConnection.Login sUserName, sPassword

        If (oALMConnection.LoggedIn <> True) Then

            MsgBox "ALM User Authentication Failed"

           Set oALMConnection = nothing

            Exit Function

        End If

        oALMConnection.Connect sDomain, sProject


        ‘QCResourceFolderFactory Object

         Set resRoot = oALMConnection.QCResourceFolderFactory.Root

         Set newFolder = resRoot.QCResourceFolderFactory.AddItem(null)

         newFolder.ParentId = resRoot.ID

         newFolder.Name = “AbhishekFolder”



           'Code to add subfolder

         Set testManager = oALMConnection.TreeManager

         Set root = testManager.NodeByPath(“Resource\AbhishekFolder\") 

         Set subFolder1=root.AddNode(“AbhishekSubFolder”)


         Set resRoot = nothing

         Set newFolder = nothing

End Function

1 Reply
Absent Member.. Trudy Claspill Absent Member..
Absent Member..

Re: How to add a new folder and subfolder to the QC Resource using OTA

The section of code you have under "Code to add subfolder" needs to use the same objects that you used in the section labeled "QCResourceFolderFactory Object". The TreeManager object is for folders in the Test Plan.

If newFolder is pointing to the folder to which you want to add a subfolder, then you can do this

set subFolder = newFolder.QCResourceFolderFactor.AddItem(null)
subfolder.ParentID = newFolder.ID
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.