Help with exporting unwanted defect attachments

Question ID: 109176
0
0

Hello. We are wanting to archive all our Defects and their attachments. Do you have a method for exporting the defects attachments?

Marked as spam
Posted by (Questions: 205, Answers: 14)
Asked on September 12, 2019 7:51 pm
9 views
Answers
0
Private answer

In order to do what you are looking for; I suggest that you use the GUI functionality in ALM to export the defects to Excel. To download the defect attachments, I would like for you to try the vbscript that I have entered below. You will need to edit both files to work in your environment. In the 'Download_Defect_Attachment.vbs' file, you will need to enter your ALM server name, your ALM username and password, the target domain and project, and the save location. Each line is marked with a comment on what needs to be changed. I have three ways that you can filter the defects you want to download the defects from. I also included the 'Start_Download_Defect_Attach.bat' file, which will need to be used on a 64-bit machine to start the 'Download_Defect_Attachment.vbs' file. In the 'Start_Download_Defect_Attach.bat', you will need to indicate the location of the 'Download_Defect_Attachment.vbs' file so that it can find it.

Note: It is suggested that you try this in a test environment before using in a production environment to make sure everything works correctly. It is also suggested to make a copy of the project repository folder and database in case any unforeseen issue occurs.

After you place the files on your machine and make the necessary edits to work in your environment, I suggest that you test the script by filtering by a single defect that has attachments, to see if the attachments are successfully downloaded to the location specified in the script. Give it a try and let me know what you think. If you have any questions or concerns, or need anything else regarding this case, please let me know.

The 'Download_Defect_Attachment' vbscript:

Create the Download_Defect_Attach vbs file

Set tdc = CreateObject(''TDApiOle80.TDConnection'')
tdc.InitConnectionEx ''http://your_alm_server:8080/qcbin'' 'Enter your server name
tdc.Login ''your_username'', ''your_password'' 'Enter your username and password

'Making enable of available domains
tdc.Connect ''target_domain'', ''target_project'' 'Enter the target domain and project

Set BugCollection = tdc.BugFactory.Filter

'You can filter by Defect ID or Defect Status
BugCollection.Filter(''BG_BUG_ID'') = ''1'' 'Filter by Defect ID
'BugCollection.Filter(''BG_STATUS'') = ''Closed'' 'Filter by the Defect Status
'BugCollection.Filter(''BG_RESPONSIBLE'') = ''qcadmin'' 'Filter by the Assigned user
Set BugList = BugCollection.NewList
bugnum = BugList.count

'print QCConnection.DomainName
MsgBox ''Getting the number of attachments for '' & bugnum & '' defect.''

For Each Bug in BugList

Set attachFact = Bug.Attachments
Set attachList = attachFact.NewList('''')
AttachmentCount = attachList.count

MsgBox ''Defect ''& bug.ID &'' has '' & AttachmentCount & '' attachments.''

For each FileAttch in attachList
zeroName = FileAttch.Name(0)
FileAttch.Load True,''C:your_save_location''

Set ExStrg = FileAttch.AttachmentStorage
ExStrg.ClientPath = ''C:your_save_location''
ExStrg.Load FileAttch.Name, True
Next

MsgBox ''The '' & AttachmentCount & '' attachments for defect '' & bug.ID & '' have been downloaded '' & vbCrLf &_
'' to the Zenith IBEW Attach folder.''

Next

Set BugCollection = Nothing
Set BugList = Nothing
Set attachFact = Nothing
Set attachList = Nothing
Set ExStrg = Nothing
Set tdc = Nothing

The 'Start_Download_Defect_Attach.bat' file script:

Create the Start_Download_Defect_Attach batch file
@%WINDIR%SysWOW64cmd.exe /k call cscript ''C:enter the location of the vbs file and include.vbs'' @pause

Marked as spam
Posted by (Questions: 2, Answers: 266)
Answered on September 12, 2019 7:54 pm