Search code examples
exchange-serverexchangewebservicesews-managed-api

Using EWS Managed API to create appointments for other users?


In EWS Managed API is it easy to create an appointment for a specific user:

ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredentials ( "administrator", "password", "domain" );
service.AutodiscoverUrl(emailAddress);

Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save();

This will create a appointment for the administrator. But say I wanted to actually create an appointment for another user (not add that user as an attendee to me appointment). It this possible via the EWS Managed API?


Solution

  • I figured it out from this article: http://msdn.microsoft.com/en-us/library/dd633680(EXCHG.80).aspx

    You should use the service.ImpersonatedUserId attribute.