Partager via


QueuedMessageEventSource.Fork method

The Fork method splits a MailItem into two branches.

Namespace:  Microsoft.Exchange.Data.Transport.Routing
Assembly:  Microsoft.Exchange.Data.Transport (in Microsoft.Exchange.Data.Transport.dll)

Syntax

'Declaration
Public MustOverride Sub Fork ( _
    recipients As IList(Of EnvelopeRecipient) _
)
'Usage
Dim instance As QueuedMessageEventSource
Dim recipients As IList(Of EnvelopeRecipient)

instance.Fork(recipients)
public abstract void Fork(
    IList<EnvelopeRecipient> recipients
)

Parameters

Remarks

The Fork method splits a MailItem into two copies. The first copy of the MailItem, the current thread, contains only the recipients that are in both the recipients parameter and in the EnvelopeRecipientCollection of the original MailItem.

The second copy of the MailItem is a clone of the MailItem that contains the remaining recipients from the EnvelopeRecipientCollection of the original MailItem. Agents receive an OnRoutedMessage event invocation for this second copy after the processing of the first copy is finished.

When you are using the Fork method in an asynchronous event handler, make the last line of the event handler a call to the Complete method. Do not destroy the instance of the AgentAsyncContext class by assigning it to a null reference (Nothing in Visual Basic). Doing this could result in a race condition or other unexpected results because the same instance of the agent that is used to fork the message is used to handle the forked message.

See also

Reference

QueuedMessageEventSource class

QueuedMessageEventSource members

Microsoft.Exchange.Data.Transport.Routing namespace