Quantcast
Viewing all articles
Browse latest Browse all 5491

Failed to Create Attachment

Hello,

I have tried to create an attachmenets but I got the following exception:

StackTrace = "   at TDAPIOLELib.IAttachment3.Post()\r\n   at ...

 

Code:

public static void uploadNewUrlAttachment1(Test test, string hyperlink)
        {
            try
            {
                if (!String.IsNullOrEmpty(hyperlink))
                {
                    FileInfo attachmentTemporaryFile = CreateUrlFile(hyperlink);

                    if (attachmentTemporaryFile != null)
                    {
                        AttachmentFactory attFactory = (AttachmentFactory)test.Attachments;

                        Attachment attachmentObject = (Attachment)attFactory.AddItem(System.DBNull.Value);
                        attachmentObject.Type = (int)tagTDAPI_ATTACH_TYPE.TDATT_FILE;
                        attachmentObject.FileName = attachmentTemporaryFile.FullName;
                        attachmentObject.Description = hyperlink;
                        attachmentObject.Post();
                        File.Delete(attachmentTemporaryFile.FullName);
                    }
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }

 

this code works without any problem with Quality Center 10.0

 

Lanquage C#

I have Windows 7

ALM 11.52

 

could you help me?

Thanks


Viewing all articles
Browse latest Browse all 5491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>