How to Send Attachments using QC 9.2 with OTA API

434 views
Skip to first unread message

sarath

unread,
Jul 7, 2008, 10:54:21 AM7/7/08
to QTP - HP Quick Test Professional - Automated Software Testing
Hello Guys,

I am using Quality center 9.2 i have created vbs file which is suppose
to send the test suites status daily basis with excel attachment.

To create this vbs file I have used OTA API & VB script the below
script is able to send the mail but attachment is not going.

Help is needed urgently

Dim QCConnection
Dim attachFact
Dim theAttachment
Dim attachList
Dim AttachmentList()
Dim HasAttachs

Set QCConnection = CreateObject("TDApiOle80.TDConnection")
QCConnection.InitConnectionEx "http://test/qcbin"
QCConnection.login "uid", "psw"

QCConnection.Connect "domine", "project"

Set TSetFact = QCConnection.TestSetFactory

Set tsTreeMgr = QCConnection.TestSetTreeManager

nPath = "Root\testfolder"

Set tsFolder = tsTreeMgr.NodeByPath(nPath)

Set attachFact = tsFolder.Attachments

Set attachList = attachFact.NewList("")

For Each theAttachment In attachList

msgbox theAttachment.FileName

Next


If Not HasAttachs Then

Set theAttachment = attachFact.AddItem(Null)

theAttachment.FileName = "C:\temp\Report.xls"

TDATT_FILE = 1

theAttachment.Type = TDATT_FILE

theAttachment.Post

End If

ReDim Preserve AttachmentList(attachList.Count - 1)

Dim i

i = LBound(AttachmentList)


For Each theAttachment In attachList

AttachmentList(i) = theAttachment.ServerFileName

i = i + 1

Next


Dim fName

For Each fName In AttachmentList

msgbox "The AttachmentList element is " & fName

Next

QCConnection.SendMail "sara...@gmail.com","","Test","Hello",
AttachmentList

msgbox "bye"

QCConnection.Disconnect
QCConnection.Logout
Set QCConnection = Nothing
Reply all
Reply to author
Forward
0 new messages