Attachments
This is a continuation of the Message Received Event section.
If the received message contains one or more file attachments, Attachments exposes the AttachmentInfo property members:
- AttachmentId — Gets the attachment id.
- CreatedDate — Gets created date.
- FileName — The file name (not including the system path) of the attachment. When an attachment is received, this property can be used to indicate the filename that the attachment should be saved as on the receiver's machine. The Linxter SDK and ISB will not make any modifications to this property while the attachment is enroute.
- MessageId — The message this attachment was sent with.
- SenderInstanceId — Gets the sender ID.
- SenderProgramId — Gets the sender's program ID. This is needed by the Linxter ISB to locate and download the attachment.
- SizeBytes — Gets the size (bytes) of this attachment.
- Tags — A collection of additional metadata tags the sender can set before sending an attachment. The tags are limited to up to 10 tags of up to 255 characters each.
Downloading Attachments
If one or more attachments were included with the received message, they have not actually been received yet, just the AttachmentInfo properties.
These are the two methods exposed for downloading any file attachments:
- DownloadAttachment — Download an attachment that is specified as part of a message received. You can obtain the parameters from the MessageReceived event's arguments AttachmentInfo array.
- DownloadAttachmentAsync — Initiates an async download of the attachment. When the download is complete, the DownloadAttachmentCompleted event will fire and its event arguments will contain the attachment. You can obtain the parameters from the MessageReceived event's arguments AttachmentInfo.
Syntax
Java Attachment downloadAttachment(AttachmentInfo attachInfo)
C# Attachment DownloadAttachment(AttachmentInfo attachInfo)
Visual Basic Function DownloadAttachment (attachInfo As AttachmentInfo) As Attachment
Parameters
attachInfo Type: Linxter.Common.Entities.AttachmentInfo
Example C# code snippet for DownloadAttachment method call
foreach (AttachmentInfo item in obj.Attachments) { // Download each attachment and save them in C:\Attachments Attachment thisAttachment = m_messaging.DownloadAttachment(item); string filename = Path.Combine("C:\\Attachments", Path.GetFileName(thisAttachment.FileName));
Example Java code snippet for DownloadAttachment method call
for (AttachmentInfo attachmentInfo : attachments) { // Download each attachment and save them in C:\Attachments Attachment attachment; String filename = new String(); attachment = messaging.downloadAttachment(attachmentInfo); filename = new String("C:\\Attachments" + attachment.getFileName());