Click or drag to resize

Example 5: Download a file

This example shows how to download a document using DownloadManager . In the following snippets ,its depicted some of the methods used to download a file.

Using DownloadFileById

In the following snippet the file could be downloaded using DownloadFileById method for a specific document Id :

C#
// Get an instance of DownloadManager
DownloadManager downloadManager = apiSession.GetDownloadManager();

// A call to the DownloadFileById
downloadManager.DownloadFileById(docId, string.Empty, roomId,
    destinationPath, lastUpdateTime, true, true);
Using DownloadFileByName

This method uses Document name to download the file :

C#
// Get an instance of DownloadManager
DownloadManager downloadManager = apiSession.GetDownloadManager();

// A call to the DownloadFileByName
downloadManager.DownloadFileByName(roomId, folderPath, docName,
    destinationPath, lastUpdateTime);
Using DownloadFileToBuffer

It is also possible to download a file to a buffer using DownloadFileToBuffer. This method returns a byte array of the file downloaded.

C#
// Get an instance of DownloadManager
DownloadManager downloadManager = apiSession.GetDownloadManager();

// A call to the DownloadFileToBuffer
byte[] buffer = downloadManager.DownloadFileToBuffer(docId, DownloadTypes.ORIGINAL);