Discuss this help topic in SecureBlackbox Forum
Clouds: Download file
To download a file from OneDrive take the following steps:
- Acquire an instance of TElOneDriveFile (or one of the descendant classes) for the needed file
either by calling TElOneDriveDataStorage.AcquireObject()
or as a result of folder list operation.
Cast the obtained object to TElOneDriveFile.
- Create a stream to which the data will be written.
- Call TElOneDriveFile.Read() or
TElOneDriveDataStorage.ReadObject()
to download file data. To read the part of the file, use the overload of TElOneDriveFile.Read()
method which accepts parameters of the part. Alternatively use TElOneDriveFile.ReadBlock() method.
Note: to read the part of the file, you need to enable Passthrough mode by setting the corresponding property of TElOneDriveDataStorage to true.
-
If you used AcquireObject() method to obtain an instance of TElOneDriveFile or cloned TElOneDriveFile,
remember to use TElOneDriveFile.Release() method after the download is complete.
C#:
TElOneDriveFile file = storage.AcquireObject(@"...") as TElOneDriveFile;
try
{
FileStream output = new FileStream(@"X:\downloaded.bin", FileMode.Create);
try
{
file.Read(output);
}
finally
{
output.Close();
}
}
finally
{
file.Release();
}
TElOneDriveDataStorage class has OnProgress event,
which allows to track and show the progress of data download, and interrupt the transfer if necessary.
If the file was encrypted or signed when it was uploaded to the server,
then during downloading of such files the additional steps are to be taken.
How To articles about Google Drive cloud
Discuss this help topic in SecureBlackbox Forum