Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET for Exchange
>
Tutorial
> Get Free/Busy for group
The following example shows you how to get free/busy information for all users belongs to group1.
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); Resource resource = new Resource(session); FreeBusy[] freeBusy = resource.GetFreeBusy("https://myserver/public", "group1"); for (int i = 0; i < freeBusy.Length; i++) { Console.WriteLine("Mailbox = " + freeBusy[i].User); DateTimeRange[] busy = freeBusy[i].Busy; DateTimeRange[] oof = freeBusy[i].OutOfOffice; DateTimeRange[] tentative = freeBusy[i].Tentative; for (int j = 0; j < busy.Length; j++) { Console.WriteLine("Busy = " + busy[j].Start + " - " + busy[j].End); } for (int k = 0; k < oof.Length; k++) { Console.WriteLine("Out of office = " + oof[k].Start + " - " + oof[k].End); } for (int l = 0; l < tentative.Length; l++) { Console.WriteLine("Tentative = " + tentative[l].Start + " - " + tentative[l].End); } } 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) Dim resource As Resource = New Resource(session) Dim freeBusy() As FreeBusy = resource.GetFreeBusy("https://myserver/public", "group1") Dim i As Integer For i = 0 To freeBusy.Length - 1 Console.WriteLine("Mailbox = " & freeBusy(i).User) Dim busy() As DateTimeRange = freeBusy(i).Busy Dim oof() As DateTimeRange = freeBusy(i).OutOfOffice Dim tentative() As DateTimeRange = freeBusy(i).Tentative Dim j As Integer = 0 For j = 0 To busy.Length - 1 Console.WriteLine("Busy = " & busy(j).Start & " - " & busy(j).End) Next Dim k As Integer = 0 For k = 0 To oof.Length - 1 Console.WriteLine("Out of office = " & oof(k).Start + " - " & oof(k).End) Next Dim l As Integer = 0 For l = 0 To tentative.Length - 1 Console.WriteLine("Tentative = " & tentative(l).Start & " - " & tentative(l).End) Next Next Console.Read() End Sub End Module