Peer.InviteAsyncCancel Method

Cancels the invitation that was sent with the InviteAsync method.

Namespace:  System.Net.PeerToPeer.Collaboration
Assembly:  System.Net (in System.Net.dll)

public void InviteAsyncCancel(
	Object userToken
)

Parameters

userToken
Type: System.Object

User defined object to pass to the callback of the InviteAsync operation for identification. This required parameter must be unique across all asynchronous invitation operations in progress.

ExceptionCondition
ArgumentNullException

The userToken parameter cannot be null.

InvalidOperationException

An asynchronous invitation is not outstanding.

Calling this method guarantees the system will cease to wait for a PeerInvitationResponse from the peer associated with the InviteAsync request.

Multiple invitations may be outstanding at any given time. If the InviteAsyncCancel method is called when an asynchronous operation identified by the userToken is not in existence, an exception is thrown. The userToken object must be provided since it is used to track a specific asynchronous call. This host application-supplied object is unique for each invite request.

When this method is used, the InviteCompleted event can still be raised, but the Cancelled property on the associated InviteCompletedEventArgs object will be set to true.

Calling this method requires a PermissionState of Unrestricted.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft