Independentsoft
Home
Products
Purchase
Support
Downloads
Company
Contact
WebDAV .NET
>
Tutorial
> List Folder
The following example shows you how to use the List method to list folder content.
C# example
using System; using System.Net; using Independentsoft.Webdav; namespace Sample { class Program { static void Main(string[] args) { NetworkCredential credential = new NetworkCredential("username", "password"); WebdavSession session = new WebdavSession(credential); Resource resource = new Resource(session); string[] list = resource.List("http://myserver/dav/"); for (int i = 0; i < list.Length; i++) { Console.WriteLine(list[i]); } //Press ENTER to exit. Console.Read(); } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Webdav Module Module1 Sub Main(ByVal args() As String) Dim credential As NetworkCredential = New NetworkCredential("username", "password") Dim session As WebdavSession = New WebdavSession(credential) Dim resource As Resource = New Resource(session) Dim list() As String = resource.List("http://myserver/dav/") Dim i As Integer For i = 0 To list.Length - 1 Console.WriteLine(list(i)) Next 'Press ENTER to exit. Console.Read() End Sub End Module