![]() |
VOOZH | about |
dotnet add package WebDav.Client --version 2.9.0
NuGet\Install-Package WebDav.Client -Version 2.9.0
<PackageReference Include="WebDav.Client" Version="2.9.0" />
<PackageVersion Include="WebDav.Client" Version="2.9.0" />Directory.Packages.props
<PackageReference Include="WebDav.Client" />Project file
paket add WebDav.Client --version 2.9.0
#r "nuget: WebDav.Client, 2.9.0"
#:package WebDav.Client@2.9.0
#addin nuget:?package=WebDav.Client&version=2.9.0Install as a Cake Addin
#tool nuget:?package=WebDav.Client&version=2.9.0Install as a Cake Tool
Asynchronous cross-platform WebDAV client for .NET Core and other runtimes. It aims to have a full support of RFC4918.
Install WebDav.Client via NuGet.
Install-Package WebDav.Client
For more information see .NET Standard.
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.
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;
WebDavClient is licensed under the MIT License. See LICENSE.txt for more details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp1.0 netcoreapp1.0 was computed. netcoreapp1.1 netcoreapp1.1 was computed. netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.1 netstandard1.1 is compatible. netstandard1.2 netstandard1.2 was computed. netstandard1.3 netstandard1.3 was computed. netstandard1.4 netstandard1.4 was computed. netstandard1.5 netstandard1.5 was computed. netstandard1.6 netstandard1.6 was computed. netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net45 net45 is compatible. net451 net451 was computed. net452 net452 was computed. net46 net46 was computed. net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen30 tizen30 was computed. tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Universal Windows Platform | uap uap was computed. uap10.0 uap10.0 was computed. |
| Windows Phone | wpa81 wpa81 was computed. |
| Windows Store | netcore netcore was computed. netcore45 netcore45 was computed. netcore451 netcore451 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on WebDav.Client:
| Package | Downloads |
|---|---|
|
EasyExtensions.WebDav
Ready-to-use library for simplifying the development of .NET applications. |
|
|
DanSaul.SharedCode
Package Description |
|
|
Carbon.Feature.Storage
Feature to support working with various storage technolgies and protocols. |
|
|
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. |
Showing the top 11 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
|
|
|
STranslate/STranslate
A ready-to-go translation ocr tool developed with WPF/WPF 开发的一款即用即走的翻译、OCR工具
|
|
|
win-acme/win-acme
Automate SSL/TLS certificates on Windows with ease
|
|
|
jayfunc/BetterLyrics
An elegant and deeply customizable lyrics visualizer & versatile music player, built with WinUI3/Win2D | 一款优雅且高度自定义的歌词可视化与全能音乐播放应用,基于 WinUI3/Win2D 构建
|
|
|
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.
|
|
|
xiaoyaocz/AllLive
获取多个直播平台的信息和弹幕
|
|
|
simple-acme/simple-acme
A simple cross platform ACME client (for use with Let's Encrypt et al.)
|
|
|
xunkong/KeqingNiuza
刻记牛杂店
|
|
|
viciousviper/DokanCloudFS
A virtual filesystem for various publicly accessible Cloud storage services on the Microsoft Windows platform.
|
|
|
securefolderfs-community/SecureFolderFS
Powerful, secure, modern way to keep your files protected.
|
|
|
InkCanvasForClass/community
InkCanvasForClass Community Open Source Project
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.9.0 | 458,331 | 3/30/2025 |
| 2.8.0 | 1,556,598 | 3/27/2022 |
| 2.7.0 | 520,786 | 5/31/2020 |
| 2.6.0 | 16,609 | 4/16/2020 |
| 2.4.0 | 9,810 | 2/15/2020 |
| 2.3.1 | 157,425 | 2/22/2019 |
| 2.3.0 | 23,666 | 8/18/2018 |
| 2.2.3 | 1,196 | 8/18/2018 |
| 2.2.2 | 1,530 | 8/8/2018 |
| 2.2.1 | 8,391 | 6/8/2018 |
| 2.2.0 | 1,354 | 6/8/2018 |
| 2.1.0 | 27,615 | 2/21/2018 |
| 2.0.1 | 60,251 | 8/20/2017 |
| 1.1.0 | 1,466 | 8/19/2017 |
| 1.0.4 | 19,631 | 8/20/2016 |
| 1.0.3 | 1,561 | 7/23/2016 |
| 1.0.2 | 2,058 | 4/11/2016 |
| 1.0.1 | 1,837 | 12/31/2015 |