How to Download a file from Quality Center (QC/ ALM) to local machine
Vote if this topic was useful to you
How to Download a file from Quality Center (QC/ ALM) to local machine
'Assign values to the variables or pass then during the function call, as arguments.
Shortfilename = "GajreFuncLibrary" 'This the file name in the QC, which you want to download.
destinationpath = "D:\Gajre\QC Temp Folder" 'Local folder path to which you want to download.
call DownloadQCResourcefile(Shortfilename,destinationpath)
Public Function DownloadQCResourcefile(Shortfilename,destinationpath)
On Error Resume Next
DownloadQCResourcefile = -1
Set oTDC = QCUtil.QCConnection
Set oResourceFactory = oTDC.QCResourceFactory
Set oRoot = oResourceFactory.NewList("")
iTotalItems = oRoot.Count
For ItemCtr = 1 To iTotalItems
CurItem = oRoot.Item(ItemCtr).Name
If UCase(CurItem) = UCase(Shortfilename) Then
Set oSub = oRoot.Item(ItemCtr)
Exit For
End If
Next
Set oRoot = Nothing
Set oResourceFactory = Nothing
Set oTDC = Nothing
If Not Isempty(oSub) Then
oSub.DownloadResource destinationpath, True
End If
If err.number<>0 Then
Exit Function
DownloadQCResourcefile=0
End if
Set fObj = nothing
Set oSub = nothing
on error goto 0
End Function
Shortfilename = "GajreFuncLibrary" 'This the file name in the QC, which you want to download.
destinationpath = "D:\Gajre\QC Temp Folder" 'Local folder path to which you want to download.
call DownloadQCResourcefile(Shortfilename,destinationpath)
Public Function DownloadQCResourcefile(Shortfilename,destinationpath)
On Error Resume Next
DownloadQCResourcefile = -1
Set oTDC = QCUtil.QCConnection
Set oResourceFactory = oTDC.QCResourceFactory
Set oRoot = oResourceFactory.NewList("")
iTotalItems = oRoot.Count
For ItemCtr = 1 To iTotalItems
CurItem = oRoot.Item(ItemCtr).Name
If UCase(CurItem) = UCase(Shortfilename) Then
Set oSub = oRoot.Item(ItemCtr)
Exit For
End If
Next
Set oRoot = Nothing
Set oResourceFactory = Nothing
Set oTDC = Nothing
If Not Isempty(oSub) Then
oSub.DownloadResource destinationpath, True
End If
If err.number<>0 Then
Exit Function
DownloadQCResourcefile=0
End if
Set fObj = nothing
Set oSub = nothing
on error goto 0
End Function
Permissions in this forum:
You cannot reply to topics in this forum
Thu Jun 19, 2014 11:31 am by thomasdfg
» How to identify the object when it is dynamically changing behavior
Wed Jun 18, 2014 6:37 pm by thomasdfg
» Patches for QTP 10, 11, 11.5
Wed Jun 18, 2014 6:04 pm by thomasdfg
» Retrieving data from Txt file into datatable
Wed Jun 18, 2014 5:32 pm by thomasdfg
» VB Script to count number of links in a web page.
Wed Jun 18, 2014 4:51 pm by thomasdfg
» Customized HTML reports in QTP
Wed Jun 18, 2014 4:42 pm by thomasdfg
» how to print values into a field of a web page, from a data table in qtp?
Wed Jun 18, 2014 4:37 pm by thomasdfg
» How to delete cookies using QTP?
Wed Jun 18, 2014 4:30 pm by thomasdfg
» When UFT Does Not Identify an Object
Wed Jun 18, 2014 4:23 pm by thomasdfg