I have been trying to create a folder structure in QC Releases folder. I could traverse the existing number of folders but I couldn't find anything for adding new folder of my choice. Here is the Sub Routine that I wrote which I plan to call by sending a path to the function in the format "Releases\XYZ\ABC". First this code will ignore the Releases keyword from the path. Then I will find for Folder XYZ and if not found it should create it. Can someone please help me with the code to add a node. Then I can continue coding further. This is my first question here so please ignore my mistakes if any.
I have tried AddNode but it did not work.
Mentioned below is the code I have written so far :
Public Sub releasePath(strPath As String)
Dim arr, bflag
Set folderFactory = tdc.releaseFolderFactory
Set folderFactoryNode = folderFactory.Filter
Set releaselist = folderFactoryNode.newList()
arr = Split(strPath, "\")
bflag = False
relesefoldercount = releaselist.Count
For i = 1 To relesefoldercount
Set releseitem = releaselist.Item(i)
If releaselist.Item(i).Name = arr(1) Then
bflag = True
End If
Next
If bflag = False Then
'create folder xyz
End
End Sub
First of all, I think your variable names are quite confusing. Your
folderFactoryNode
is a TDFilter object and yourreleaselist
actually is a list of ReleaseFolder objects and not a list of Releases. To create a new ReleaseFolder you need to call AddItem of the ReleaseFolderFactory. In your case, to create the first level folders you need something like that (untested, directly from the OTA API documentation):For deeper levels (the ABC folder in your example), you can use AddItem of the ReleaseFolderFactory of the XYZ folder.