Table of Contents

Method PromoteAsync

Namespace
MailFathom.Application.Contacts
Assembly
MailFathom.Application.dll

PromoteAsync(ContactBookScope, ContactId, ContactOrigin, CancellationToken)

Takes a collected contact on, by writing the user's own copy of it.

public Task<ContactWriteResult> PromoteAsync(ContactBookScope scope, ContactId contactId, ContactOrigin writer, CancellationToken cancellationToken)

Parameters

scope ContactBookScope

The books the caller reads, whose own book the copy is written into.

contactId ContactId

The contact to promote.

writer ContactOrigin

The origin the writer acts under.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<ContactWriteResult>

The promoted record, or the refusal naming what stopped it.

Remarks

It copies rather than moves, because the record it is promoting is the mailbox's and the mailbox may be somebody else's too. So the collected record stays where it is, for whoever else is assigned that account, and what the caller gains is a record of their own — with a new identity, because it is a new record in a different book — which the read then shows in place of the collected one. A user who wants the collected record gone as well erases it, which is the act that reaches the mailbox's book.

It is gated on the writer for the reason an amendment is: promotion is the user taking a record on, so collection asking for it is refused rather than granted the authority it was about to award itself. A contact that is already the caller's own is answered as such rather than written again, so a user repeating the request learns that nothing was left to do.

The writer and the grant answer different questions and both are asked: the grant says whether this caller may write to the book at all, and the writer says whether the record's own origin admits what it is about to do.

Both surfaces reach it, because promotion is what a collected record is *for*: an agent that read the book and found somebody the deployment picked up has the same standing to take that record on as an operator at a terminal, and a promotion reachable from one of them would leave collection's own output editable from the other only by erasing it and writing it again. What the alternative does not widen is which writer may perform it — collection acts under its own origin and IsPromotableBy(ContactOrigin) refuses it there.

An administrator admitted below the deployment promotes only out of the collected books their own scope covers, because a copy lands in a book that scope reads: promoting out of a mailbox the user shares would carry a record of that mailbox to somebody whose scope does not reach it.

Exceptions

ArgumentNullException

Thrown when scope is null.

PersistenceConcurrencyConflictException

Thrown when every allowed attempt lost the race.

PrincipalNotAuthorizedException

Thrown when the write was reached by anything but a caller granted AdminOperate or ContactsWrite.