Cloud Mail 2020 Android Edition

Questions / Feedback?

AddAttachment Method

Adds an attachment to an existing message.

Syntax

public void addAttachment(String messageId, String name, String localFile);

Remarks

This method adds an attachment to an existing message, specified by the MessageId parameter. To add a more complex attachment, set the Name and LocalFile parameters and the component will use the first attachment in the MessageAttachments collection. As a note, this will not clear the MessageAttachments collection. If the file is larger than the value set in the AttachmentSimpleUploadLimit configuration, then the component will use an upload session to upload the attachment in fragments. The size of the fragments are specified in the AttachmentFragmentSize configuration.

This method is not used to add attachments to messages that are sent with the SendMail method.

Example (Adding a Simple Attachment to a New Draft)


office365.CreateDraft(0, "");
String messageId = office365.MessageInfo[0].Id;

office365.AddAttachment(messageId, "file1.zip", "C:\file1.zip");
Example (Adding a Simple Attachment to a New Draft)


office365.MessageSubject = "Subject";
office365.MessageBodyContentType = "html";
office365.MessageBodyContent = "<p>Body</p><img src='cid:test1'>";
office365.MessageTo = "email@example.com";
office365.CreateDraft(0, "");
String messageId = office365.MessageInfo[0].Id;

office365.AddAttachment(messageId, "file1.zip", "C:\file1.zip");
Example (Adding a Complex Attachment to a New Draft)
office365.MessageSubject = "Subject";
office365.MessageBodyContentType = "html";
office365.MessageBodyContent = "<p>Body</p><img src='cid:test1'>";
office365.MessageTo = "email@example.com";
office365.CreateDraft(0, "");
      
string messageId = office365.MessageInfo[0].Id;

office365.MessageAttachments.Add(new OLAttachment("test picture", "./test.txt"));
office365.MessageAttachments[0].IsInline = true;
office365.MessageAttachments[0].ContentId = "test1";
office365.AddAttachment(messageId, "", "");

office365.SendDraft(messageId);

Copyright (c) 2022 /n software inc. - All rights reserved.
Cloud Mail 2020 Android Edition - Version 20.0 [Build 8308]