CSDNCurrent en:Transfer Polling

Aus Cryptshare Documentation
Wechseln zu:Navigation, Suche



Transfer Polling

You can use the .NET API Client's method RequestActiveTransfers() to obtain a list of all active transfers that have been sent to the client's email address. The client has to be verified for this method to succeed. The method will return a map, with the transfer meta IDs as keys, and the corresponding download urls (without the password) as values. A download url will have the format "https://cryptshare.server.com/download1.php?id=33d03d8d6b", where the id parameter is the transfer meta id.

Example: Request active transfers

// First create the Client instance
// Create a WebServiceUri for your Cryptshare Server 
WebServiceUri serviceUri = new WebServiceUri("https://cryptshare.server.com");
  
// Create a CryptshareConnection instance for your WebServiceUri
CryptshareConnection connection = new CryptshareConnection(serviceUri);
  
// Create the Client instance with the email address of the recipient, for which you want to get the transfers, 
// the CryptshareConnection, and the path to the verification store.
Client client = new Client("John.Doe@server.com", connection, @"C:\temp");

// Request the active transfers for this client
// Returns a Map containing all transfer ids and download urls for all active transfers that were sent to this client's 
// e-mail address (in this example: "John.Doe@server.com"). 
// This method will throw an exception if the client/e-mail address has not been verified.
Dictionary<string, string> transferIdMap = client.RequestActiveTransfers();

foreach (KeyValuePair<string, string> pair in transferIdMap)
{
    Console.WriteLine("Entry in transfer id map: metaId = " + pair.Key + " url = " + pair.Value);
}