Click or drag to resize

IItemContentAsync Interface

IT Hit WebDAV Classes Reference
Provides file upload and download functionality.

Namespace:  ITHit.WebDAV.Client
Assembly:  ITHit.WebDAV.Client (in ITHit.WebDAV.Client.dll) Version: 2.0.420.0
Syntax
public interface IItemContentAsync

The IItemContentAsync type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleContentLength
Length of the file content.
Public propertyContentType
Content type of the file.
Public propertyEtag
Gets entity tag - string that identifies current state of file's content.
Public propertyResumableUpload
Returns instance of IResumableUploadAsync to manage partially failed uploads.
Top
Methods
  NameDescription
Public methodCode exampleDownloadAsync
Downloads content of the file to a file specified by filename
Public methodCode exampleGetReadStreamAsync
Loads content of the file from WebDAV server.
Public methodGetReadStreamAsync(Int64, Int64)
Loads part of the content of the file from WebDAV server.
Public methodCode exampleGetReadStreamAsync(Int64, Int64, DateTime)
Loads part of the content of the file from WebDAV server using lastModifiedUtc to ensure the content is up-to-date.
Public methodCode exampleGetReadStreamAsync(Int64, Int64, String)
Loads part of the content of the file from WebDAV server using eTag to ensure the content is up-to-date.
Public methodCode exampleGetWriteStreamAsync(Int64)
Saves file's content to WebDAV server.
Public methodCode exampleGetWriteStreamAsync(String, Int64)
Saves file's content to WebDAV server.
Public methodCode exampleGetWriteStreamAsync(String, Int64, String)
Saves files's content to WebDAV server.
Public methodCode exampleUploadAsync(String)
Uploads content of a file specified by filename to the server
Public methodCode exampleUploadAsync(String, String)
Uploads content of a file specified by filename to the server
Top
Remarks
You can use UploadAsync(String) / DownloadAsync(String) methods fo upload and download files to file system and GetWriteStreamAsync(Int64) / GetReadStreamAsync(Int64, Int64) to upload and download files stored in a database or any other storage.
Examples
The following example demonstrates how to upload a file from local file system to a WebDAV server.
string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");
IFolderAsync folder = await session.OpenFolderAsync(new Uri("http://server:8080/Sales"));

IFileAsync file = await folder.CreateFileAsync("products.xlsx");
file.AllowWriteStreamBuffering = false;
file.TimeOut = 36000000; // 10 hours
await file.UploadAsync("C:\\products.xlsx");
Examples
In the following example a file is downloaded from a WebDAV server to local file system.
string license = "<?xml version='1.0' encoding='utf...
WebDavSessionAsync session = new WebDavSessionAsync(license);
session.Credentials = new NetworkCredential("User1", "pwd");

IFileAsync file = await session.OpenFileAsync(new Uri("http://server:8080/Products/image.gif"));
file.TimeOut = 36000000; // 10 hours
await file.DownloadAsync("C:\\image.gif");
See Also