Programatically Get File Attachment

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
KCraver
Posts: 4
Joined: Thu Sep 06, 2007 8:36 am

Programatically Get File Attachment

Post by KCraver » Thu Dec 19, 2013 2:00 pm

We're using Vault Pro 5.1.2 and C# .NET

I have tried using the API to retrieve a file attachment on a Vault/Dragnet item, but the AttStream property of the MantisItemAttachmentFullDetail object is null. I presume this is because the API does not support serializing/deserializing files between the server and client.

I have also tried getting the FileContents field from the dbo.attachments table in the sgdragnet database, but the field uses a text data type which I haven't been able to properly convert to binary.

Can I get some advice on how to properly deserialize the text FileContents field into binary or how to use the API to retrieve a file attachment?

jclausius
Posts: 3702
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Programatically Get File Attachment

Post by jclausius » Fri Dec 20, 2013 10:43 am

Attachment downloads are a little bit tricky. You'll need to know the message id (msgid) and the attachment id (attid). I believe if you have a collection of attachment items you can get the attid and the msgid. Once you have that info, you can use the Client Integration Helper library - ItemTrackingOperations.ProcessCommandDownloadFortressAttachment()
or
look at using ClientInstance.Connection.DownloadDragnetAttachment()
Jeff Clausius
SourceGear

Post Reply