Re: Downloading attachment from defect raised in QC using TDApiOle80.TDConnection (1927 Views)
Reply
Occasional Advisor
WW531846
Posts: 12
Registered: ‎11-18-2010
Message 1 of 9 (1,958 Views)

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
Honored Contributor
Massimo De Rosa
Posts: 656
Registered: ‎03-02-2009
Message 2 of 9 (1,927 Views)

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
Massimo De Rosa
Posts: 656
Registered: ‎03-02-2009
Message 3 of 9 (1,927 Views)

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
WW531846
Posts: 12
Registered: ‎11-18-2010
Message 4 of 9 (1,927 Views)

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

It worked exactly what i want cheers, Pradeep
Honored Contributor
Massimo De Rosa
Posts: 656
Registered: ‎03-02-2009
Message 5 of 9 (1,927 Views)

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
WW531846
Posts: 12
Registered: ‎11-18-2010
Message 6 of 9 (1,927 Views)

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
Massimo De Rosa
Posts: 656
Registered: ‎03-02-2009
Message 7 of 9 (1,927 Views)

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

Hi, see the attach.

Ciao, Massimo.
Occasional Advisor
WW531846
Posts: 12
Registered: ‎11-18-2010
Message 8 of 9 (1,927 Views)

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

Working good,
Thanks Mate

Occasional Advisor
WW531846
Posts: 12
Registered: ‎11-18-2010
Message 9 of 9 (1,927 Views)

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

Perfect Solution
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.