Discuss this help topic in SecureBlackbox Forum

WebDAV: Download resource from server

If you want to download some data to a local file, you can use TElWebDAVClient.DownloadFile() method. It lets you resume downloading and choose what to do, if the file already exists.

Unlike upload operations, for downloads the WebDAV client does not let you download the data directly to the byte array. Instead you need to create a stream, download the data to the stream, reset stream position to 0 and read the data to the byte array if you need.

To download the data to the stream you use one of TElWebDAVClient.DownloadStream() or TElWebDAVClient.Download() methods.

Examples:

C#:


TElWebDAVClient cli = new TElWebDAVClient();
cli.BaseURL = @"http://remote.com/dav_folder";

MemoryStream ms = MemoryStream();

cli.DownloadStream(@"http://remote.com/file.dat", ms, TSBFileTransferMode.ftmOverwrite);

// reset stream position before use
ms.Position = 0;

// use ms
...

How To articles about WebDAV client

Discuss this help topic in SecureBlackbox Forum