Friday, July 8, 2016

Download Attachments from ALM(QC) TestPlan Folder


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

' QC Connection to TestPlan Folder ------ Refer 'ALM Quality Center Connectivity' post
Set treeMgr = gTDConn.TreeManager
Set SubjRoot = treeMgr.NodeByPath(strQCAttachmentsPath)
Set otaAttachmentFactory = subjRoot.Attachments

Set fso = CreateObject("Scripting.FileSystemObject")

'Download Attachments and Copy to local folder
For i = 1 to otaAttachmentList.Count   

 Set otaAttachmentFilter = otaAttachmentFactory.Filter
 otaAttachmentFilter.Filter("CR_REFERENCE") = "'ALL_LISTS_" & SubjRoot.NodeID & "_*'"
 Set otaAttachmentList = otaAttachmentFilter.NewList

 Set otaAttachment = otaAttachmentList.Item(i)   
 otaAttachment.Load True""
 QCFileName = split(strFile,"ALL_LISTS_" & subjRoot.NodeID & "_")       
 DwnladFileName = QCFileName(1)   

'Copy downloaded file to local folder
 fso.CopyFile otaAttachment.FileName, strDownloadLocation & “\” & DwnladFileName

Next

No comments:

Post a Comment