Skip to content

Update/Replace/AddAttachment to draft but keep the unique message id #1845

Closed Answered by jstedfast
snailcatcher asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to incrementally add attachments, it would be best to download the entire message and add them w/o the use of the BodyBuilder (BodyBuilder, honestly, is for constructing new messages and not adding to existing messages).

The BodyBuilder.ToMessageBody() method replaces the existing message body with the new content.

You can do something more like this:

var message = await folder.GetMessageAsync(uniqueId.Value, cancellationToken);

if (message == null)
   throw new EmailNotFoundException($"The draft email with id '{emailId}' could not be found.");

// Note: we want to add attachments but make no other change to the message. Since attachments
// are typically added to the top-lev…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@snailcatcher
Comment options

@snailcatcher
Comment options

@jstedfast
Comment options

Answer selected by snailcatcher
@snailcatcher
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants