Coder Social home page Coder Social logo

webdavclient's Introduction

WebDAVClient

Abount

Strongly-typed, async WebDAV Client implementation in C#.

WebDAVClient is based originally on https://github.com/kvdb/WebDAVClient. I've added Async support (instead of Callback), as well strong-types responses.

Contact

You can contact me on twitter @saguiitay.

NuGet

WebDAVClient is available as a NuGet package

Release Notes

  • 1.0.0 Initial release.

Usage

// Basic authentication required
var client = new WebDAVClient.Client(new NetworkCredential { UserName = "USERNAME" , Password = "PASSWORD"});
// OR without authentication
var client = new WebDAVClient.Client(new NetworkCredential());

// Set basic information for WebDAV provider
client.Server = "https://webdav.4shared.com";
client.BasePath = "/";

// Retrieve list of items in root folder
var files = await client.List();

// Find folder named 'Test'
var folder = files.FirstOrDefault(f => f.Href.EndsWith("/Test/"));

// Reload folder 'Test'
var folderReloaded = await client.Get(folder.Href);

// Retrieve list of items in 'Test' folder
var folderFiles = await client.List(folder.Href);

// Find first file in 'Test' folder
var folderFile = folderFiles.FirstOrDefault(f => f.IsCollection == false);
// Downlaod file into a Stream
var stream = await client.Download(folderFile.Href);

// Upload a file (with a random name) to 'Test' folder
var tempName = Path.GetRandomFileName();
var fileUploaded = await client.Upload(folder.Href, File.OpenRead(@"<PATH TO FILE>"), tempName);

// Create a folder (with a random name) in the 'Test' folder
tempName = Path.GetRandomFileName();
var folderCreated = await client.CreateDir(folder.Href, tempName);

webdavclient's People

Contributors

saguiitay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.