Hi there, I was wondering if there is some way to take this code from your example and build it into my Helper Class for exchange? The code:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new WebCredentials("UserID", "Password"); // not real :)
service.AutodiscoverUrl("support@organization.com");
service.Url = new Uri("https://************************************/exchange.asmx");
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "support@organization.com");
// this week
DateTime startDate = DayPilot.Utils.Week.FirstDayOfWeek();
DateTime endDate = startDate.AddDays(7);
try
{
// load the default calendar
CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
// load events
CalendarView cView = new CalendarView(startDate, endDate, 50);
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Id);
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
// assign appointments
DayPilotCalendar1.DataSource = appointments;
// map item properties
DayPilotCalendar1.DataStartField = "Start";
DayPilotCalendar1.DataEndField = "End";
DayPilotCalendar1.DataIdField = "Id";
DayPilotCalendar1.DataTextField = "Subject";
// load and display appointments in DayPilot Calendar
DayPilotCalendar1.DataBind();
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.ToString());
}