I am wondering if it is possible to pass credentials of current user to ExchangeService object.
Currently I am providing specific UserName/Password to WebCredentials in order to authenticate the ExchangeService access but instead I want to use credential of current user by using SPContext.Current.Web.CurrentUser.UserToken.
Here my code which create appointments:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = new WebCredentials("UserName", "password", "domain.contoso.com");
service.Url = new Uri("https://computername.domain.contoso.com/EWS/Exchange.asmx");
Appointment appointment = new Appointment(service);
foreach (MailAddress MailAddress in MailAddresses)
{
appointment.RequiredAttendees.Add(MailAddress.Address);
}
appointment.Subject = Title;
appointment.Body = Summary;
appointment.Start = StartDate;
appointment.End = EndDate;
appointment.IsResponseRequested = true;
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);