Quality Center / ALM Practitioners Forum
cancel

Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

WW531846
Regular Contributor.

Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

what is the query to use to download attachment from defect raised in QC using TDApiOle80.TDConnection in MACRO
8 REPLIES
Massimo De Rosa
Acclaimed Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

Hi,

you have to do like this:

Set tdc = createobject("TDApiOle80.TDConnection")

Set MyBug = tdc.BugFactory.Item(IDofTheBugYouWant)

Set AttachList = MyBug.AttachFactory.NewList("")

for each elAtt in AttachList
Set MyAtt = MyBug.AttachFactory.Item(elAtt.ID)

'in vbscript you have to do as i found in the OTA API reference that is:

MyAtt.Load True, ""
msgbox MyAtt.FileName

' To get the path in VBScript, extract if from
' the filename:
theFileName = MyAtt.FileName
thePath = Left(theFileName, InstrRev(theFileName, "\")-1)

'these are the instructions to get the path where the file was download. i didn't try but this could be usefull.

set MyAtt = Nothing

next

Set AttachList = Nothing
Set MyBug = Nothing
Set tdc = Nothing


Hope this helps.

Ciao, Massimo.

https://www.motu4qc.it
https://motu4qc-en.jimdo.com
Massimo De Rosa
Acclaimed Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

sorry there is a little mistake..

change AttachFactory with Attachments.

ciao, Massimo.
https://www.motu4qc.it
https://motu4qc-en.jimdo.com
WW531846
Regular Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

It worked exactly what i want cheers, Pradeep
Massimo De Rosa
Acclaimed Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

OK, you can close this thread.

Happy to solve your issue.

Ciao,Massimo.
https://www.motu4qc.it
https://motu4qc-en.jimdo.com
WW531846
Regular Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

last query,how to change the filepath of defect attachment getting downloaded,Since when i tired to change it file path MyAtt.Filename ="C:\xxx\" it is throwing error like "FileName cannot be changed.Your inputs please......
Massimo De Rosa
Acclaimed Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

Hi, see the attach.

Ciao, Massimo.
https://www.motu4qc.it
https://motu4qc-en.jimdo.com
WW531846
Regular Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

Working good,
Thanks Mate

Highlighted
WW531846
Regular Contributor.

Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

Perfect Solution