Hi Arindra,

Try this one and let us know which version of QC you are using.

'Get the client temp folder - create it if it does not exist

Set flib = CreateObject("Scripting.FileSystemObject")

len1=len(Environment.value("UserName"))

If Not flib.FolderExists(flib.GetSpecialFolder(2)) Then

flib.CreateFolder(flib.GetSpecialFolder(2))

End If

tempfolder = flib.GetSpecialFolder(2)

tempfolder=left(tempfolder,12+len1)



'Create an object for the Quality center

Set tdc = TDUtil.TDConnection

set tm = tdc.TreeManager

set root = tm.TreeRoot("Subject")

set folder = root.FindChildNode("Automated Tests") 'Folder where the
child test data is saved

set folder =folder.FindChildNode("TestData")

Set fact = folder.Attachments

Set alist = fact.NewList("")



'Find the right attachment and download it to the temp folder

For Each att In alist

Set ext = att.AttachmentStorage

attname = att.DirectLink



If InStr(attname,"general_testdata.xls") > 0 Then

ext.Load attname, True



''Copy the attachment to a file with the original filename

flib.CopyFile ext.ClientPath & "\" & attname, tempfolder & "\" &
"general_testdata.xls"

Exit For

End If

Next


On Wed, Jan 5, 2011 at 4:22 AM, Arindra <[email protected]> wrote:
> I have tried the followin code to Download attachment from QC:
>
> QCpath = "[QualityCenter]Subject\temp"
> FileName = "Dec2010.zip"
> Dim App 'As Application
> Set App = CreateObject("QuickTest.Application")
>
> App.Folders.RemoveAll
> App.Folders.Add(QCpath)
> Var = PathFinder.Locate(FileName)
> If Trim(Var) <> "" Then
> CreateObject("Scripting.FileSystemObject").CopyFile Var, "D:\QTP-SPIN
> \Dec2010.zip"
> End If
> App.Folders.RemoveAll
> Set App = Nothing
>
> For the first time it was working fine but after that
> "App.Folders.Add(QCpath)" command is not working. After executing the
> mentioned line i checked the "QTP-Tools-Options-Folders" path and
> there is nothing written, then i manually add the
> "[QualityCenter]Subject\temp" but at run time it( "QTP-Tools-Options-
> Folders" path) was also blank.
> Please provide me the solution or the possible work around
> Thanks in Advance
> Arindra
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en



-- 
regd,
mrinal

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to