Solved : Attachments uploading with 0kb size in ALM/QC using OTA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'Create a TDConnection Object,TreeManager Object
Set UploadFolder = TreeMgr.NodeByPath(ALM_Upload_Folder)
Set tstAttachmentFactory = UploadFolder.Attachments
 
'Null refers to reserving space for a attachment
Set fileToUpload = tstAttachmentFactory.AddItem(Null)
 
'Provide full path of the file to attach
fileToUpload.Filename = "C:\Projects\Automation\abc.qfl"
 
'Add a description to the attachment
 fileToUpload.Description = "via Script"
 
'Add below line to avoid file upload with 0KB size,Specify type = 1(any file) 
 fileToUpload.Type = 1
 
'Finally attaches the file to specified node
 fileToUpload.Post

That’s it. If you miss the type you will end up with uploading file with 0kb.
In case of any issue or error still persists,leave a comment below.