Description
WebDAV .NET is a WebDAV client library for .NET. It lets you list, upload, download, copy, move, rename, lock and delete files and folders, read and update properties, and use the WebDAV extensions in common use on any WebDAV server. It is built on HttpClient, every request method is asynchronous, and it has no dependencies besides .NET.
What is new in version 2.0
- A new client, WebdavClient, built on HttpClient: every request method is asynchronous and can be canceled.
- Progress reporting for uploads and downloads, resumable downloads and conditional uploads with ETags.
- Lock tokens are submitted automatically when the client changes a resource it locked.
- Recursive listing works on servers that refuse Depth infinity (Apache, IIS, Nextcloud).
- Errors throw WebdavException with the HTTP status and the reason the server gave.
- Access control, quota, synchronization, search, extended MKCOL, bindings, ordered collections and versioning.
Supported .NET Versions
- .NET Standard 2.0
- .NET 8.0, .NET 9.0, .NET 10.0 and later, .NET 5.0 to 7.0, .NET Core 2.0 and later
- .NET Framework 4.6.2 and later (4.7.2 or later recommended)
- Mono, Xamarin and Unity
Features
- List folders and subfolders with the size, content type, dates and ETag of each file
- Create, copy, move, rename and delete files and folders; check whether they exist
- Upload and download files and streams, with progress reporting and cancellation
- Resume interrupted downloads; update part of a file
- Get, set and remove properties, including XML values, in one atomic request
- Exclusive and shared locks on files and folders, refresh, unlock and lock discovery
- Prevent lost updates with ETags; create a file only if it does not exist
- The current user's permissions, owners, access control lists, finding users and groups
- Quota (used and available space)
- Changes in a collection since the last synchronization
- Search for files with conditions, sorting and limits
- Discover what a server supports
- Basic, Digest, NTLM and Negotiate (Kerberos) authentication, proxies, client and server certificates, timeouts
- Errors with the HTTP status, the server's reason and the result for each resource
Supported Specifications
- RFC 4918 - HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)
- RFC 9110 - HTTP Semantics: conditional requests (ETags) and range requests
- RFC 3253 - Versioning Extensions to WebDAV: REPORT, expand-property, version control, check-out, check-in, version history
- RFC 3648 - WebDAV Ordered Collections Protocol
- RFC 3744 - WebDAV Access Control Protocol: privileges, access control lists, principals, principal search
- RFC 4331 - Quota and Size Properties for DAV Collections
- RFC 4437 - WebDAV Redirect Reference Resources
- RFC 4709 - Mounting WebDAV Servers
- RFC 5323 - WebDAV SEARCH (basicsearch)
- RFC 5397 - WebDAV Current Principal Extension
- RFC 5689 - Extended MKCOL for WebDAV
- RFC 5842 - Binding Extensions to WebDAV
- RFC 5995 - Using POST to Add Members to WebDAV Collections
- RFC 6578 - Collection Synchronization for WebDAV
- RFC 7240 and RFC 8144 - Prefer Header for HTTP and its use in WebDAV
Tested Servers
Every example in the tutorial is tested against Apache HTTP Server mod_dav, SabreDAV (the WebDAV server of Nextcloud and ownCloud) and Go x/net/webdav. WebDAV .NET works with any server that implements RFC 4918.
Examples
Getting started
List, create, copy, move, delete files and folders
Download
Upload
Get and set properties
Lock/Unlock
Quota, permissions and reports