Table of Contents

Method StageAsync

Namespace
MailFathom.Application.Mail.Delivery.Drafts
Assembly
MailFathom.Application.dll

StageAsync(MailDraftId, AuthoredEmailAttachment, CancellationToken)

Stages one file against a draft the caller's user is writing.

public Task<MailDraftAttachment> StageAsync(MailDraftId draftId, AuthoredEmailAttachment file, CancellationToken cancellationToken)

Parameters

draftId MailDraftId

The draft the file is attached to.

file AuthoredEmailAttachment

What the file is called, what it declares itself to be, and the octets it is made of.

cancellationToken CancellationToken

Cancels the read and the write.

Returns

Task<MailDraftAttachment>

The staged file as the write left it.

Remarks

The draft's stored message is left exactly as it was: a staged file joins the message where the next revision is composed, so uploading a file and saving the draft are two acts and the second is the one that changes what the message is. That is what keeps a large file from being re-composed and re-appended on the strength of an upload the author may still take back.

Exceptions

ArgumentNullException

Thrown when file is null.

PrincipalNotAuthorizedException

Thrown when the caller does not hold MailDraftsWrite, or is acting for no user.

MailDraftRefusedException

Thrown when the caller's user holds no draft still being written under that identifier, when the draft already carries as many files as a message may, or when the file is larger than one this deployment composes.

PersistenceConcurrencyConflictException

Thrown when the write did not commit on any allowed attempt.