01-02-2012, 04:35 PM
Please try the below code
Code:
Public Function Func_DownloadAttachement_FromQC(pvt_QC_Folders_NodeName, pvt_LocalFolderPathWhereFileshaveTobeDownloaded)
Set tdc=TDUtil.TDConnection
Set gTreeManager = tdc.TreeManager
Set root=gTreeManager.TreeRoot("Subject")
set gSysTreeNode = gTreeManager.NodeByPath(pvt_QC_Folders_NodeName)
Set fact=gSysTreeNode.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 'other functionality att.id, att.filename
Out_file_Name = Replace(attname, gSysTreeNode.NodeID,"")
ext.Load attname, True
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.GetFile(ext.ClientPath & "\" & attname)
MyFile.Copy ( pvt_LocalFolderPathWhereFileshaveTobeDownloaded & "\" & Out_file_Name)
Set fso = Nothing
Set MyFile = Nothing
Next
End Function