| || |
TDAPI: How to add an attachment
Hello TestDirector freaks!
I'm trying to connect to TD by using the API with Visual C++. So far it works, but I have one special problem: I cannot add file attachments. Whenever I try to change the type of a created Attachment object, I get the exception: "Attachment type cannot be changed". What am I doing wrong?
Here a sample code in C++ (should also be readable for VB users):
//Connect to the server and project
theTestSetFactory = sp_td->GetTestSetFactory();
theTestSet = theTestSetFactory->GetItem(mytsId);
theTestSet->Name = "MyTestSet";
theAttachmentFactory = theTestSet->GetAttachments();
_bstr_t myAttachmentData = "A Attachment";;
theAttachment = theAttachmentFactory->AddItem(myAttachmentDataVariant);
theAttachment->PutDescription("A file for test!");
// The next line throws an execption: "Attachment type cannot be changed"
myAttachmentData = "image.jpg";
//Disconnect from project and release connection from the server.
So where is the bug in the code above????
Many thanks in advance,
Re: TDAPI: How to add an attachment
Did you ever figure this out? I'm having a similar problem...using VBScript.