Quality Center / ALM Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Downloading attachment from defect raised in QC using TDApiOle80.TDConnection

Occasional Advisor

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
Honored Contributor Honored 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.

Honored Contributor Honored Contributor

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

sorry there is a little mistake..

change AttachFactory with Attachments.

ciao, Massimo.
Occasional Advisor

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

It worked exactly what i want cheers, Pradeep
Honored Contributor Honored 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.
Occasional Advisor

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......
Honored Contributor Honored Contributor

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

Hi, see the attach.

Ciao, Massimo.
Occasional Advisor

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

Working good,
Thanks Mate

Highlighted
Occasional Advisor

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

Perfect Solution