Пример #1
0
        /// <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);
            }
        }
        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);
        }
        /// <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);
        }