Saturday, July 9, 2016

Attach files to ALM(QC) TestPlan folder

' Input - QC Folder Path and Local Folder Path
strQCFolderPath= “Subject\Automatin\TestCases”
strUpladAttachmentsLocation= “C:\QCFiles”

' QC Connection to TestPlan Folder ------ Refer 'ALM Quality Center Connectivity' post
Set treeMgr = gTDConn.TreeManager
Set tsFolder = treeMgr.NodeByPath(strQCFolderPath)
Set tsList = tsFolder.Attachments

'Read all files    
Set objfso = CreateObject("Scripting.FileSystemObject")
Set objfolder = objfso.GetFolder(strUpladAttachmentsLocation)
Set objfiles = objfolder.Files

'Attach files one by one to QC folder     
For Each afile In objfiles
 UpladFileName = afile.Name                    
 Set otaAttachmentList = tsList.AddItem(Null)         
 otaAttachmentList.FileName = strUpladAttachmentsLocation & "\" & UpladFileName
 otaAttachmentList.Type = 1
 otaAttachmentList.Post
 otaAttachmentList.Save False
 Set otaAttachmentList = Nothing
Next   

No comments:

Post a Comment