Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET for Exchange
>
Tutorial
> List folder and subfolders
The following example shows you how to use List method to recursive list content of entire mailbox.
C# example
using System; using System.Net; using Independentsoft.Webdav.Exchange; namespace Sample { class Program { static void Main(string[] args) { NetworkCredential credential = new NetworkCredential("username", "password"); WebdavSession session = new WebdavSession(credential); session.UserMailbox = "https://myserver/exchange/emailaddress"; Resource resource = new Resource(session); Mailbox myMailbox = resource.Mailbox; string[] list = resource.List(myMailbox.Root, true); 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.Exchange Module Module1 Sub Main(ByVal args() As String) Dim credential As NetworkCredential = New NetworkCredential("username", "password") Dim session As WebdavSession = New WebdavSession(credential) session.UserMailbox = "https://myserver/exchange/emailaddress" Dim resource As Resource = New Resource(session) Dim myMailbox As Mailbox = resource.Mailbox Dim list() As String = resource.List(myMailbox.Root, True) 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