Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET for Exchange
>
Tutorial
> Check if user is free at given time
The following example shows you how to check if specified users are free at given time.
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); string[] mailboxes = { "John", "Peter", "Ted" }; FreeBusy[] freeBusy = resource.GetFreeBusy("https://myserver/public", mailboxes); DateTime start = DateTime.Today; DateTime end = DateTime.Today.AddDays(1); for (int i = 0; i < freeBusy.Length; i++) { bool isFree = freeBusy[i].IsFree(start, end); if (isFree) { Console.WriteLine(freeBusy[i].User + " is free today"); } } 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 mailboxes() As String = {"John", "Peter", "Ted"} Dim freeBusy() As FreeBusy = resource.GetFreeBusy("https://myserver/public", mailboxes) Dim startDate As DateTime = DateTime.Today Dim endDate As DateTime = DateTime.Today.AddDays(1) Dim i As Integer For i = 0 To freeBusy.Length - 1 Dim isFree As Boolean = freeBusy(i).IsFree(startDate, endDate) If isFree Then Console.WriteLine(freeBusy(i).User & " is free today") End If Next Console.Read() End Sub End Module