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.
In the following snippet the file could be downloaded using DownloadFileById method for a specific document Id :
// Get an instance of DownloadManager DownloadManager downloadManager = apiSession.GetDownloadManager(); // A call to the DownloadFileById downloadManager.DownloadFileById(docId, string.Empty, roomId, destinationPath, lastUpdateTime, true, true);
This method uses Document name to download the file :
// Get an instance of DownloadManager DownloadManager downloadManager = apiSession.GetDownloadManager(); // A call to the DownloadFileByName downloadManager.DownloadFileByName(roomId, folderPath, docName, destinationPath, lastUpdateTime);
It is also possible to download a file to a buffer using DownloadFileToBuffer. This method returns a byte array of the file downloaded.
// Get an instance of DownloadManager DownloadManager downloadManager = apiSession.GetDownloadManager(); // A call to the DownloadFileToBuffer byte[] buffer = downloadManager.DownloadFileToBuffer(docId, DownloadTypes.ORIGINAL);