WebDAVClient 3.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package WebDAVClient --version 3.0.3
                    
NuGet\Install-Package WebDAVClient -Version 3.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebDAVClient" Version="3.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebDAVClient" Version="3.0.3" />
                    
Directory.Packages.props
<PackageReference Include="WebDAVClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebDAVClient --version 3.0.3
                    
#r "nuget: WebDAVClient, 3.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebDAVClient@3.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebDAVClient&version=3.0.3
                    
Install as a Cake Addin
#tool nuget:?package=WebDAVClient&version=3.0.3
                    
Install as a Cake Tool

WebDAVClient

Browse WebDAV storage and transfer files from C#/.NET applications. Upload, download, copy, move and delete files without hand-writing DAV requests or parsing XML. Supports .NET 8 and .NET 10.

dotnet add package WebDAVClient

The v3 API, DavClient, is available from NuGet starting with 3.0.0, released October 20, 2026. No local library build is required.

Authenticate, list files and download one

Set WEBDAV_ENDPOINT to your HTTPS collection URL, ending in /, and configure WEBDAV_USERNAME and WEBDAV_PASSWORD outside source control. Set WEBDAV_REMOTE_FILE to the name of an existing file in that collection. WEBDAV_OUTPUT optionally selects a new local output path (default download.bin).

Paste this complete program into a console application after installing the package:

using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
using WebDAVClient;
using WebDAVClient.Helpers;

try
{
    string Required(string name) => Environment.GetEnvironmentVariable(name)
        ?? throw new ArgumentException("Set " + name + ".");

    var endpoint = new Uri(Required("WEBDAV_ENDPOINT"));
    if (endpoint.Scheme != Uri.UriSchemeHttps)
    {
        throw new ArgumentException("Use HTTPS for credentials.");
    }

    using var http = new HttpClient(new HttpClientHandler
    {
        Credentials = new NetworkCredential(
            Required("WEBDAV_USERNAME"), Required("WEBDAV_PASSWORD")),
        UseDefaultCredentials = false,
        AllowAutoRedirect = false,
        AutomaticDecompression = DecompressionMethods.None,
        UseCookies = false
    });
    using var client = new DavClient(endpoint, http);
    using var deadline = new CancellationTokenSource(TimeSpan.FromSeconds(60));

    var listing = await client.PropFindAsync(
        DavPath.Root, cancellationToken: deadline.Token);
    listing.EnsureSucceeded();
    foreach (var resource in listing.Resources)
    {
        Console.WriteLine(resource.Hrefs[0]);
    }

    using var download = await client.DownloadAsync(
        DavPath.FromSegments(Required("WEBDAV_REMOTE_FILE")),
        cancellationToken: deadline.Token);
    download.EnsureHttpSuccess();
    var content = download.Content
        ?? throw new IOException("The server returned no downloadable content.");
    var output = Environment.GetEnvironmentVariable("WEBDAV_OUTPUT") ?? "download.bin";
    await using var file = new FileStream(output, FileMode.CreateNew, FileAccess.Write);
    await content.CopyToAsync(file, deadline.Token);
    Console.WriteLine("Download complete.");
    return 0;
}
catch (WebDAVException ex)
{
    Console.Error.WriteLine($"WebDAV failed: HTTP {ex.ResponseStatusCode ?? ex.GetHttpCode()}.");
    Console.Error.WriteLine("Check the endpoint, credentials, permissions and remote filename.");
    return 1;
}
catch (OperationCanceledException)
{
    Console.Error.WriteLine("The operation timed out or was cancelled.");
    return 130;
}
catch (Exception ex) when (ex is HttpRequestException || ex is IOException || ex is UnauthorizedAccessException
    || ex is ArgumentException || ex is UriFormatException)
{
    Console.Error.WriteLine(ex.Message);
    return 1;
}

The listing includes the collection itself and its immediate children. FileMode.CreateNew prevents overwriting an existing local file; a failed copy can leave a partial file. The getting-started guide explains configuration, errors, partial-file handling and the runnable equivalent. Use an app password, not a bearer token, when your server requires one.

Find the right guide

Task Guide and matching runnable example
Choose anonymous, credentials, Windows or bearer authentication Authentication
List folders, stream large listings and read typed/custom properties Listing and properties
Upload, download and request byte ranges File transfers
Create folders, copy, move and delete safely File management
Acquire, refresh and release a lock; make conditional writes Locking
Request an RFC 6578 change batch Collection synchronization
Diagnose failures, cancellation and resource ownership Errors and lifetimes
Check Nextcloud, ownCloud, IIS, Apache and other servers Server compatibility
Check supported methods, RFCs and extensions Protocol support
Migrate from Client / IClient or find advanced configuration Detailed API and legacy reference

Nextcloud and ownCloud compatibility is not verified by this project. Implemented protocol features and unit tests are not server compatibility certification. Neither API automatically retries mutations.

Run the examples

git clone https://github.com/saguiitay/WebDAVClient.git
Set-Location WebDAVClient
dotnet run --project examples\WebDAVClient.Examples -f net10.0 -- --help

Examples are read-only unless you explicitly enable writes. Each has a guide covering prerequisites, expected results and failure cases. See the documentation index.

Contribute and license

See development and testing and release notes. WebDAVClient is distributed under MIT. The provenance notice retains attribution for the original kvdb/WebDAVClient.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on WebDAVClient:

Package Downloads
SuperiorAcumaticaPackage

Dependencies required to compile the SuperiorAcumaticaSolution for Acumatica 2026 R1 Build 26.101.0225

CodeLogic.Storage

Provider-neutral storage abstractions and providers for CodeLogic applications

IServNET

C# Api for interacting with the IServ System.

YngveHestem.Storage.WebDAV

WebDAV storage provider implementation for the YngveHestem.Storage abstractions.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on WebDAVClient:

Repository Stars
EasyTidy/EasyTidy
EasyTidy A simple file auto-classification tool makes it easy to create automatic workflows with files. / EasyTidy 一个简单的文件自动分类整理工具 轻松创建文件的自动工作流程
Version Downloads Last Updated
3.3.0 0 10/23/2026
3.2.0 66 10/21/2026
3.1.1 62 10/21/2026
3.1.0 66 10/21/2026
3.0.4 69 10/21/2026
3.0.3 104 10/21/2026
3.0.2 71 10/21/2026
3.0.1 72 10/21/2026
3.0.0 84 10/20/2026
2.8.0 87 10/20/2026
2.7.0 3,679 5/1/2026
2.5.5 139 5/1/2026
2.5.4 128 5/1/2026
2.5.3 128 5/1/2026
2.5.2 127 5/1/2026
2.5.1 130 5/1/2026
2.5.0 142 5/1/2026
2.4.0 139 5/1/2026
2.3.0 11,281 9/4/2025
2.2.1 50,668 8/25/2023
Loading failed

Version 3.0.3
* Documentation: Lead with an authenticated list-and-download application and move detailed contracts and legacy recipes into focused guides.
* Examples: Add runnable authentication, listing/properties, transfer, file-management, locking and collection-sync examples with matching guides and regression coverage.
* Compatibility: Separate server verification evidence from implemented protocol and extension support; no unverified compatibility or conformance claims.
* No library API or runtime behavior changes.
Version 3.0.2:
* Discovery: Describe WebDAV storage and file-transfer use cases and expand NuGet search tags, without claiming verified Nextcloud or ownCloud compatibility.
* Documentation: Explain server-specific compatibility limits in the README overview.
* No public API or runtime behavior changes.
Version 3.0.1:
* Documentation: Correct the embedded README to identify 3.0.0 as released on October 20, 2026 and install v3 from NuGet without a local build.
* Licensing: Declare MIT as the single package license with owner authorization; retain historical upstream attribution and the previous license record.
* No public API or runtime behavior changes.
Version 3.0.0 (released 2026-10-20):
* New resource-oriented DavClient with immutable endpoints, request-scoped options and no implicit discovery.
* Lossless XML property values, exact resource/property outcomes, typed property codecs and structured DAV errors.
* Conditional requests, full structured DAV If expressions, ordered atomic PROPPATCH and safe namespace replacement defaults.
* HEAD, response-owning downloads, verified byte ranges, explicit upload ownership, shared/exclusive locks and streamed listings with completion tracking.
* Public REPORT execution seam and an explicit sync-level 1 collection synchronization batch profile; no durable sync or automatic retries.
* Shared XML readers with legacy compatibility projections; existing Client/IClient signatures and transport ownership retained.
* Migration guidance and contract tests for both .NET 8 and .NET 10. This release does not claim full RFC conformance.
* Release hardening: Reject property-only namespace mutation outcomes and nested LOCK scalar markup; preserve streamed-listing rejection errors with bounded reads.
* Examples: Add a modern sample, require explicit legacy partial-PUT opt-in, and compile complete README examples on both targets.
Legacy improvements already released in 2.8.0:
* Developer experience: Ship XML documentation for both targets, safe configurable examples, early argument validation, qualified property statuses, explicit authentication factories, sanitized exception context, and complete configuration/ownership guidance.
* Configuration: Reject ineffective client TLS callbacks on injected transports and validate owned upload timeouts before transport allocation.
* Sample correctness: Report transfer-integrity failures with a nonzero exit while retaining run-owned cleanup.
* PROPPATCH correctness: Read statuses and descriptions only from direct propstat children, never nested property values.
* Performance: Filter listings in place, skip unused property-name XML, retain only selected single-item results, avoid PUT response buffering, and coordinate concurrent root discovery.
* Reliability: Cancellable asynchronous metadata parsing with configurable body deadlines; cancellation-aware discovery; consistent 409 exceptions; complete response ownership; member-level mutation recovery diagnostics.
* Bug fixes: Correct partial transfer ranges, connection reconfiguration, URL joining, sparse listings, targeted XML values, PROPFIND failure statuses, OPTIONS discovery, empty-namespace properties and hidden values.
* Security: Reject absolute WebDAV URLs outside the configured origin (scheme, hostname and effective port), preventing metadata-driven HTTPS downgrades and credential disclosure.
* Security: Scope PROPFIND resource identities and typed properties to their DAV namespace and structural position.
Historical context (already released in 2.7.0):
* Feature: WebDAV LOCK / UNLOCK support (RFC 4918 §9.10–9.11).
* Feature: WebDAV PROPPATCH support — set / remove custom properties (RFC 4918 §9.2).
* Bug fix: COPY / MOVE now send the Overwrite header (RFC 4918 §9.8.3 / §9.9.3); 204 No Content accepted as success.
* Bug fix: DELETE now sends Depth: infinity (RFC 4918 §9.6.1).
* Feature: per-call lock-token submission via the If header on PUT / DELETE / MOVE / COPY (RFC 4918 §10.4).
* Internal refactor: extracted Client.cs static helpers into focused, unit-testable helper classes under WebDAVClient.Helpers.
* Feature: PROPFIND request-body variants — <prop> and <propname/> in addition to <allprop/> (RFC 4918 §9.1).
* Feature: HTTP OPTIONS support — discover DAV compliance classes and allowed methods (RFC 4918 §9.1, RFC 9110 §9.3.7).
* Feature: Bearer token / OAuth 2.0 authentication via new Client constructor overloads (static token or async refreshable provider).