WebDav.Client 2.9.0

dotnet add package WebDav.Client --version 2.9.0
                    
NuGet\Install-Package WebDav.Client -Version 2.9.0
                    
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="WebDav.Client" Version="2.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
                    
Directory.Packages.props
<PackageReference Include="WebDav.Client" />
                    
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 WebDav.Client --version 2.9.0
                    
#r "nuget: WebDav.Client, 2.9.0"
                    
#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.
#addin nuget:?package=WebDav.Client&version=2.9.0
                    
Install WebDav.Client as a Cake Addin
#tool nuget:?package=WebDav.Client&version=2.9.0
                    
Install WebDav.Client as a Cake Tool

WebDAV .NET client Build status

Asynchronous cross-platform WebDAV client for .NET Core and other runtimes. It aims to have a full support of RFC4918.

Installation

Install WebDav.Client via NuGet.

Install-Package WebDav.Client

Supported platforms

  • .NET Core 1.0+
  • .NET Framework 4.5+
  • Mono
  • Xamarin
  • UWP

For more information see .NET Standard.

Usage notes

WebDavClient uses HttpClient under the hood that is why it is a good practice to share a single instance for the lifetime of the application.

If you use a dependency injection container to manage dependencies it is a good practice to register WebDavClient as a singleton.

It's also possible to instantiate WebDavClient with a pre-configured instance of HttpClient.

When using GetRawFile / GetProcessedFile don't forget to dispose the response.

Usage examples

Basic usage

class Example
{
    public static IWebDavClient _client = new WebDavClient();

    public void MakeCalls()
    {
        var result = await _client.Propfind("http://mywebdav/1.txt");
        if (result.IsSuccessful)
            // continue ...
        else
            // handle an error
    }
}

Using BaseAddress

var clientParams = new WebDavClientParams { BaseAddress = new Uri("http://mywebdav/") };
using (var client = new WebDavClient(clientParams))
{
    await client.Propfind("1.txt");
}

Operations with files and directories (resources & collections)

var clientParams = new WebDavClientParams { BaseAddress = new Uri("http://mywebdav/") };
using (var client = new WebDavClient(clientParams))
{
    await client.Mkcol("mydir"); // create a directory

    await client.Copy("source.txt", "dest.txt"); // copy a file

    await client.Move("source.txt", "dest.txt"); // move a file

    await client.Delete("file.txt", "dest.txt"); // delete a file

    using (var response = await client.GetRawFile("file.txt")) // get a file without processing from the server
    {
        // use response.Stream
    }

    using (var response = await client.GetProcessedFile("file.txt")) // get a file that can be processed by the server
    {
        // use response.Stream
    }

    await client.PutFile("file.xml", File.OpenRead("file.xml")); // upload a resource
}

Authentication using an access token

var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = 
    new AuthenticationHeaderValue("Bearer", accessToken);
var client = new WebDavClient(httpClient);

Authentication using NetworkCredential

var clientParams = new WebDavClientParams
{
    BaseAddress = new Uri("http://mywebdav/"),
    Credentials = new NetworkCredential("user", "12345")
};
var client = new WebDavClient(clientParams);

PROPFIND example

// list files & subdirectories in 'mydir'
var result = await _client.Propfind("http://mywebdav/mydir");
if (result.IsSuccessful)
{
    foreach (var res in result.Resources)
    {
        Trace.WriteLine("Name: " + res.DisplayName);
        Trace.WriteLine("Is directory: " + res.IsCollection);
        // etc.
    }
}

PROPFIND with custom properties

var propfindParams = new PropfindParameters
{
    Namespaces = new [] { new NamespaceAttr("myns", "https://example.com/") },
    CustomProperties = new [] { XName.Get("myprop", "https://example.com/") }
};
var result = await client.Propfind("http://mywebdav/mydir", propfindParams);

Custom headers

var propfindParams = new PropfindParameters
{
    Headers = new List<KeyValuePair<string, string>>
    {
        new KeyValuePair<string, string>("User-Agent", "Not a browser")
    }
};
var result = await _client.Propfind("http://mywebdav/1.txt", propfindParams);

Content-Range or other content headers

// Content headers need to be set directly on HttpContent instance.
var content = new StreamContent(File.OpenRead("test.txt"));
content.Headers.ContentRange = new ContentRangeHeaderValue(0, 2);
var result = await _client.PutFile("http://mywebdav/1.txt", content);

Synchronous API

  // will block the current thread, so use it cautiously
  var result = _client.Propfind("1.txt").Result;

License

WebDavClient is licensed under the MIT License. See LICENSE.txt for more details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.1 is compatible.  netstandard1.2 was computed.  netstandard1.3 was computed.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wpa81 was computed. 
Windows Store netcore was computed.  netcore45 was computed.  netcore451 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 1.1

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (18)

Showing the top 5 NuGet packages that depend on WebDav.Client:

Package Downloads
DanSaul.SharedCode

Package Description

CloudFS-Signed

The CloudFS library is a collection of .NET assemblies as gateways to various publicly accessible Cloud storage services.

CloudFS

The CloudFS library is a collection of .NET assemblies as gateways to various publicly accessible Cloud storage services.

Carbon.Feature.Storage

Feature to support working with various storage technolgies and protocols.

EasyExtensions.WebDav

Ready-to-use library for simplifying the development of .NET applications.

GitHub repositories (6)

Showing the top 6 popular GitHub repositories that depend on WebDav.Client:

Repository Stars
2dust/v2rayN
A GUI client for Windows, Linux and macOS, support Xray and sing-box and others
win-acme/win-acme
A simple ACME client for Windows (for use with Let's Encrypt et al.)
ZGGSONG/STranslate
A ready-to-go translation ocr tool developed with WPF/WPF 开发的一款即用即走的翻译、OCR工具
Yu-Core/SwashbucklerDiary
侠客日记是一个开源、跨平台的本地日记app,使用Blazor开发,支持Android,Windows,macOS,Web,Linux。"SwashbucklerDiary" is an open source cross-platform local diary app using Blazor , support Android,Windows,macOS,Web,Linux.
xunkong/KeqingNiuza
刻记牛杂店
viciousviper/DokanCloudFS
A virtual filesystem for various publicly accessible Cloud storage services on the Microsoft Windows platform.
Version Downloads Last updated
2.9.0 12,465 3/30/2025
2.8.0 1,044,077 3/27/2022
2.7.0 499,540 5/31/2020
2.6.0 13,888 4/16/2020
2.4.0 8,731 2/15/2020
2.3.1 145,857 2/22/2019
2.3.0 22,781 8/18/2018
2.2.3 966 8/18/2018
2.2.2 1,281 8/8/2018
2.2.1 7,851 6/8/2018
2.2.0 995 6/8/2018
2.1.0 26,917 2/21/2018
2.0.1 44,238 8/20/2017
1.1.0 1,130 8/19/2017
1.0.4 18,532 8/20/2016
1.0.3 1,217 7/23/2016
1.0.2 1,713 4/11/2016
1.0.1 1,480 12/31/2015
1.0.0 1,258 11/4/2015
0.0.1 2,081 10/6/2015