CSDNCurrent en:Revoke a Transfer

Aus Cryptshare Documentation
Wechseln zu:Navigation, Suche



The transfer may be revoked if e.g. access to previously provided and outdated information needs to be prohibited for all recipients.

Usage

It is possible for the sender to revoke their transfer and notify the recipients about the revocation by calling `Client.RevokeTransfer` and passing the transfer's tracking ID. The sender also receives a notification email as a confirmation:

client.RevokeTransfer("my-tracking-id");

By default, the Cryptshare Server sends a notification email containing a default message to all transfer recipients. It is possible to provide a custom message for the recipients of the transfer:

const string message = "The information in this document are no longer valid and a transfer containing updated information has been provided. Please disregard this transfer.";
client.RevokeTransfer("my-tracking-id", message);

If you want to control whether the sender and/or recipients should receive a notification email, you can provide additional parameters:

// Send a notification email to the recipients, but not the sender.
client.RevokeTransfer("my-tracking-id", true, false);
// Same as above, but also provide a custom message.
const string message = "A new transfer containing updated documents is on its way, please ignore this transfer.";
client.RevokeTransfer("my-tracking-id", true, false, message);

Error Handling

Attempting to revoke a transfer might result in an exception which should be handled. For instance, attempting to revoke a non-existent transfer or a transfer for which the client is not the sender results in a `CryptshareServerException`:

try
{
	client.RevokeTransfer("transfer-is-not-mine-or-does-not-exist");
}
catch (CrypshareServerException e)
{
	Console.Error.WriteLine("Failed to revoke the transfer: " + e);
}

If you cannot guarantee that the target Cryptshare Server supports the "Revoke Transfer" feature (see ), you may want to wrap the call in a try-catch since the API will throw a NotSupportedException if the Cryptshare Server does not support the operation.

try
{
	client.RevokeTransfer("my-tracking-id");
}
catch (NotSupportedException e)
{
	Console.Error.WriteLine("The Cryptshare Server does not support revoking a transfer: " + e);
}