/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var appointmentData = context.GetValue(Appointment) ?? GetAppointmentFromParameters(context); var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var recurrMeeting = new Appointment(service) { Subject = appointmentData.Subject, Body = new MessageBody(appointmentData.IsBodyHtml ? BodyType.HTML : BodyType.Text, appointmentData.Body), Start = appointmentData.StartTime, End = appointmentData.EndTime, Location = appointmentData.Subject, Recurrence = appointmentData.Recurrence }; var requiredAttendees = context.GetValue(RequiredAttendees); var optionalAttendees = context.GetValue(OptionalAttendees); AppointmentHelper.UpdateAttendees(recurrMeeting, requiredAttendees, optionalAttendees); // This method results in in a CreateItem call to EWS. recurrMeeting.Save(SendInvitationsMode.SendToAllAndSaveCopy); context.SetValue(AppointmentId, recurrMeeting.Id); }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { // The activity will forward the AppointmentId referecned appointment only to not-responding attendees with ReminderText as a forward var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var appointment = AppointmentHelper.GetAppointmentById(service, context.GetValue(AppointmentId)); if (appointment == null) { return; } var toRemind = new List <EmailAddress>(); toRemind.AddRange( appointment .RequiredAttendees .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived)); toRemind.AddRange( appointment .OptionalAttendees .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived)); // Remind if any if (toRemind.Count > 0) { appointment.Forward(context.GetValue(ReminderText), toRemind); } }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var continueOnError = context.GetValue(ContinueOnError); var attendees = AppointmentHelper.ResolveAttendeeNames(service, context.GetValue(AttendeeNames), continueOnError); context.SetValue(Attendees, attendees.ToArray()); }
public void LoadAppointentByIdTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); DateTime.TryParse("10-Jun-2019", out var start); var meeting = AppointmentHelper.GetAppointmentBySubject(service, "Item1", start); AppointmentHelper.GetAppointmentById(service, meeting.Id.ToString()); Assert.AreEqual(1, 1); }
public void LoadAppointentBySubjTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var subj = "Item1"; DateTime.TryParse("10-Jun-2019", out var start); AppointmentHelper.GetAppointmentBySubject(service, subj, start); Assert.AreEqual(1, 1); }
public void ResolveNamesTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); string[] testNames = { "Obfuscated attendee1", "Obfuscated attendee2" }; var attendees = AppointmentHelper.ResolveAttendeeNames(service, testNames, true); foreach (var item in attendees) { Console.WriteLine(item.Name + "::" + item.Address); } }
public void LoadResponseByIdTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var subj = "Item1"; DateTime.TryParse("10-Jun-2019", out var start); var meeting = AppointmentHelper.GetAppointmentBySubject(service, subj, start); AppointmentHelper.GetAttendeesById(service, meeting.Id.ToString(), MeetingAttendeeType.Required); Assert.AreEqual(1, 1); }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService( context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var id = context.GetValue(AppointmentId); var meeting = Appointment.Bind(service, new ItemId(id), new PropertySet(AppointmentSchema.Recurrence)); meeting.Delete(DeleteMode.MoveToDeletedItems, SendCancellationsMode.SendToAllAndSaveCopy); }
public void LoadAppointmentsTest() { var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); DateTime.TryParse("10-Jun-2019", out var start); var meeting = AppointmentHelper.GetAppointmentBySubject(service, "Item1", start); var appointments = AppointmentHelper.GetAppointmentsById(service, meeting.Id.ToString()); foreach (var item in appointments) { Console.WriteLine(item.AppointmentType.ToString()); } }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService( context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); // GetMaster Item // Bind to all RequiredAttendees. var meeting = Appointment.Bind(service, new ItemId(context.GetValue(AppointmentId)), AppointmentHelper.GetAttendeesPropertySet()); AppointmentHelper.UpdateAttendees(meeting, context.GetValue(RequiredAttendees), context.GetValue(OptionalAttendees)); // Save and Send Updates meeting.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToChanged); }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); var start = context.GetValue(AppointmentDateFrom); var appointmentSubject = context.GetValue(AppointmentSubject); var amount = context.GetValue(Amount); var itemView = new ItemView(amount) { PropertySet = new PropertySet( ItemSchema.Subject, AppointmentSchema.Start, ItemSchema.DisplayTo, AppointmentSchema.AppointmentType, ItemSchema.DateTimeSent) }; // Find appointments by subject. var substrFilter = new SearchFilter.ContainsSubstring(ItemSchema.Subject, appointmentSubject); var startFilter = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, start); var filterList = new List <SearchFilter> { substrFilter, startFilter }; var calendarFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, filterList); var results = service.FindItems(WellKnownFolderName.SentItems, calendarFilter, itemView); var history = results.Select(item => new NotifyHistory { Subject = item.Subject, SentOn = item.DateTimeSent, SentTo = item.DisplayTo }).ToArray(); context.SetValue(SentNotificationsHistory, history); }
/// <inheritdoc /> protected override void Execute(CodeActivityContext context) { var service = ExchangeHelper.GetService(context.GetValue(OrganizerPassword), context.GetValue(ExchangeUrl), context.GetValue(OrganizerEmail)); Appointment meeting; var id = context.GetValue(AppointmentId); if (string.IsNullOrEmpty(id)) { var start = DateTime.Parse(context.GetValue(AppointmentDate)); meeting = AppointmentHelper.GetAppointmentBySubject(service, context.GetValue(Subject), start); } else { meeting = AppointmentHelper.GetAppointmentById(service, id); } context.SetValue(FoundAppointment, meeting); }
public void AttachedAppointmentTest() { DateTime.TryParse("06-July-2019", out var testStartDate); var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var appointment = AppointmentHelper.GetAppointmentBySubject(service, "AppointmentAttachmentCheck1", testStartDate); if (appointment != null) { var toRemind = AppointmentHelper.GetAttendeesById(service, appointment.Id.ToString(), MeetingAttendeeType.Required) .Where(x => x.ResponseType == MeetingResponseType.Unknown || x.ResponseType == MeetingResponseType.NoResponseReceived) .Select(attendee => (EmailAddress)attendee.Address) .ToList(); // remind if any if (toRemind.Count > 0) { appointment.Forward("Please resond to an attached invitation", toRemind); } } Assert.AreNotEqual(1, 2); }
public void ForwardedAppointmentTest() { DateTime.TryParse("06-July-2019", out var testStartDate); var service = ExchangeHelper.GetService(ExchangePass, ExchangeServerUrl, ExchangeLogin); var itemView = new ItemView(10) { PropertySet = new PropertySet(ItemSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.AppointmentType) }; // Find appointments by subject. var substrFilter = new SearchFilter.ContainsSubstring(ItemSchema.Subject, "AppointmentAttachmentCheck1"); var startFilter = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, testStartDate); var filterList = new List <SearchFilter> { substrFilter, startFilter }; var calendarFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, filterList); var results = service.FindItems(WellKnownFolderName.SentItems, calendarFilter, itemView); foreach (var cur in results) { var item = Item.Bind(service, cur.Id, new PropertySet(ItemSchema.Subject, AppointmentSchema.Start, ItemSchema.DisplayTo, AppointmentSchema.AppointmentType, ItemSchema.DateTimeSent)); var displayTo = item.DisplayTo; Console.WriteLine(displayTo); Console.WriteLine(item.DateTimeSent); } Assert.AreEqual("AppointmentAttachmentCheck1", "AppointmentAttachmentCheck1"); }