NextCloud Download

PHOTO EMBED

Wed Jun 23 2021 05:32:19 GMT+0000 (Coordinated Universal Time)

Saved by @hoehn00d #c# #nextcloud #asp.net #webdav

public static async void downloadAllFiles() {

    var credentials = new NetworkCredential("USERNAME", "PASSWORD");
    var webDavSession = new WebDavSession(@"https://cp.DOMAIN/remote.php/dav/files/USERNAME/", credentials);
    var items = await webDavSession.ListAsync(@"APK-Test/");

    foreach (var item in items)
    {
        //await webDavSession.DownloadFileAsync(item.Uri, STREAM);

        WebClient myWebClient = new WebClient();
        myWebClient.Credentials = credentials;
        myWebClient.DownloadFile(item.Uri, @"C:\temp" + item.Name);

        Console.WriteLine(item.Name);
    }

}
content_copyCOPY