Created
January 17, 2017 09:17
-
-
Save bschapendonk/fd80715a7875da4a7de94077baa75d07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Exchange.WebServices.Data; | |
using System; | |
namespace EWS_FindAppointments | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); | |
service.Url = new Uri("https://<exchangeServer>/ews/exchange.asmx"); | |
service.Credentials = new WebCredentials(@"<username>", "<password>"); | |
var folderId = new FolderId(WellKnownFolderName.Calendar, new Mailbox("<meetingroom>")); | |
var calendar = CalendarFolder.Bind(service, folderId, new PropertySet()); | |
var calendarView = new CalendarView(DateTime.Today, DateTime.Today.AddDays(3).AddTicks(-1), 10); | |
calendarView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End); | |
var appointments = calendar.FindAppointments(calendarView); | |
foreach (Appointment a in appointments) | |
{ | |
Console.Write("Subject: " + a.Subject.ToString() + " "); | |
Console.Write("Start: " + a.Start.ToString() + " "); | |
Console.Write("End: " + a.End.ToString()); | |
Console.WriteLine(); | |
} | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment