/// <summary> /// Create a mailbox appointment /// </summary> /// <param name="mailboxUrl">The mailbox URL to create the appointment at</param> /// <param name="appointment">The appointment to create</param> /// <returns>The URL of the created appointment</returns> public string CreateAppointment(string mailboxUrl, Appointment appointment) { string body = WebDavXmlResources.GetText( WebDavXmlResources.CreateAppointment, appointment.Subject, appointment.Body, appointment.Comment, appointment.IsPrivate ? "1" : "0", appointment.AllDayEvent ? "1" : "0", DateUtil.FormatDateForExchange(appointment.EndDate), DateUtil.FormatDateForExchange(appointment.StartDate), Convert.ToInt32(appointment.InstanceType), appointment.Location, appointment.MeetingStatus.ToString(), appointment.ResponseStatus.ToString(), appointment.Organizer, appointment.BusyStatus.ToString()); if (!mailboxUrl.EndsWith("/")) { mailboxUrl += "/"; } string appointmentUrl = string.Format( "{0}{{{1}}}.eml", mailboxUrl, Guid.NewGuid().ToString()); IssueRequestIgnoreResponse(appointmentUrl, Method.PROPPATCH, body); appointment.HRef = appointmentUrl; return(appointmentUrl); }
/// <summary> /// Load a set of appointments from the server /// </summary> /// <param name="folderUrl">The mailbox URL</param> /// <param name="start">Start time of date range to fetch</param> /// <param name="end">End time of date range to fetch</param> /// <returns>A list of appointments from the mailbox</returns> public virtual List <Appointment> LoadAppointments( string folderUrl, DateTime start, DateTime end) { using (BlockTimer bt = new BlockTimer("LoadAppointments")) { string request = WebDavXmlResources.GetText( WebDavXmlResources.FindAppointments, folderUrl, DateUtil.FormatDateForDASL(start), DateUtil.FormatDateForDASL(end)); string response = IssueRequestAndFetchReponse(folderUrl, Method.SEARCH, request); XmlDocument responseXML = ParseExchangeXml(response); return(ParseAppointmentResultSetXml(responseXML)); } }
/// <summary> /// Update an existing appointment /// </summary> /// <param name="mailboxUrl">The URL of the appointment in the mailbox</param> /// <param name="appointment">The Update Appointment value</param> /// <returns>The appointment URL</returns> public string UpdateAppointment(string mailboxUrl, Appointment appointment) { string body = WebDavXmlResources.GetText( WebDavXmlResources.CreateAppointment, appointment.Subject, appointment.Body, appointment.Comment, appointment.IsPrivate ? "1" : "0", appointment.AllDayEvent ? "1" : "0", DateUtil.FormatDateForExchange(appointment.EndDate), DateUtil.FormatDateForExchange(appointment.StartDate), Convert.ToInt32(appointment.InstanceType), appointment.Location, appointment.MeetingStatus.ToString(), appointment.ResponseStatus.ToString(), appointment.Organizer, appointment.BusyStatus.ToString()); IssueRequestIgnoreResponse(appointment.HRef, Method.PROPPATCH, body); return(appointment.HRef); }