Quote:not an event: appointment.Id "Appointment.id" Value cannot be null (Parameter 'itemId')
public async Task<bool> CreateAppointmentAsync() { var spinId = Guid.NewGuid(); StringBuilder apptBody = new StringBuilder(); var httpClient = new System.Net.Http.HttpClient(); System.Net.Http.HttpResponseMessage response; bool success = false; var username = _employee.Email; try { string ewsUrl = "https://outlook.office365.com/EWS/Exchange.asmx"; ExchangeService servicex = new ExchangeService(ExchangeVersion.Exchange2007_SP1); servicex.UseDefaultCredentials = true; servicex.Credentials = new WebCredentials("user@domain.com", "password"); servicex.Url = new Uri(ewsUrl); servicex.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "user@domain.com"); Appointment appointment = new Appointment(servicex); // Set the properties on the appointment object to create the appointment. appointment.Subject = "Tennis lesson"; appointment.Body = "Focus on backhand this week."; appointment.Start = DateTime.Now.AddDays(2); appointment.End = appointment.Start.AddHours(1); appointment.Location = "Tennis club"; appointment.ReminderDueBy = DateTime.Now; appointment.Save(SendInvitationsMode.SendToNone); Item item = await Item.Bind(servicex, appointment.Id, new PropertySet(ItemSchema.Subject)); success = true; MessageBox.Show("Sucessfully Event Created"); Console.WriteLine("Subject of the retrieved appointment: " + item.Subject); } catch (Exception ex) { MessageBox.Show(ex.Message); return success; } finally { // Stop spinner Thread.Sleep(100); _eventAggregator.GetEvent<CloseControlEvent>().Publish(spinId.ToString()); } return success; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)