Ejemplo n.º 1
0
 public static MeetingResponse EditResponse(ResponseType responseType, CalendarItemBase calendarItemBase)
 {
     if (calendarItemBase == null)
     {
         throw new ArgumentNullException("calendarItemBase");
     }
     MeetingUtilities.ThrowIfMeetingResponseInvalid(calendarItemBase);
     return(MeetingUtilities.EditResponseInternal(responseType, calendarItemBase));
 }
Ejemplo n.º 2
0
        private static MeetingResponse EditResponseInternal(ResponseType responseType, CalendarItemBase calendarItemBase)
        {
            ExTraceGlobals.CalendarTracer.TraceDebug(0L, "Create meeting response and edit");
            calendarItemBase.LocationIdentifierHelperInstance.SetLocationIdentifier(54431U, LastChangeAction.RespondToMeetingRequest);
            MeetingResponse meetingResponse = MeetingUtilities.CreateMeetingResponse(responseType, calendarItemBase, true);

            meetingResponse.Save(SaveMode.ResolveConflicts);
            MeetingUtilities.ProcessCalendarItemAfterResponse(responseType, calendarItemBase, true);
            return(meetingResponse);
        }
Ejemplo n.º 3
0
        public static void ThrowIfMeetingResponseInvalid(MeetingMessage meetingMessage)
        {
            MeetingUtilities.ThrowIfWebParts();
            MeetingRequest meetingRequest = meetingMessage as MeetingRequest;

            if (meetingRequest != null && meetingRequest.IsMailboxOwnerTheSender())
            {
                throw new OwaOperationNotSupportedException(LocalizedStrings.GetNonEncoded(679811893));
            }
            MeetingUtilities.ThrowIfInArchiveMailbox(meetingMessage);
        }
Ejemplo n.º 4
0
 public static void ThrowIfMeetingResponseInvalid(CalendarItemBase calendarItemBase)
 {
     MeetingUtilities.ThrowIfWebParts();
     if (calendarItemBase.IsOrganizer())
     {
         throw new OwaOperationNotSupportedException(LocalizedStrings.GetNonEncoded(679811893));
     }
     if (calendarItemBase.IsCancelled)
     {
         throw new OwaOperationNotSupportedException("Cannot respond to a cancelled meeting.");
     }
     MeetingUtilities.ThrowIfInArchiveMailbox(calendarItemBase);
 }
Ejemplo n.º 5
0
 private static void NonEditResponseInternal(ResponseType responseType, CalendarItemBase calendarItemBase, bool sendResponse)
 {
     ExTraceGlobals.CalendarTracer.TraceDebug(0L, "Process meeting response without editing");
     calendarItemBase.LocationIdentifierHelperInstance.SetLocationIdentifier(42143U, LastChangeAction.RespondToMeetingRequest);
     using (MeetingResponse meetingResponse = MeetingUtilities.CreateMeetingResponse(responseType, calendarItemBase, sendResponse))
     {
         if (sendResponse)
         {
             meetingResponse.Send();
         }
     }
     MeetingUtilities.ProcessCalendarItemAfterResponse(responseType, calendarItemBase, sendResponse);
 }
Ejemplo n.º 6
0
 public static void NonEditResponse(ResponseType responseType, CalendarItemBase calendarItemBase, bool sendResponse, MeetingRequest meetingRequest)
 {
     if (calendarItemBase == null)
     {
         throw new ArgumentNullException("calendarItemBase");
     }
     MeetingUtilities.ThrowIfMeetingResponseInvalid(calendarItemBase);
     MeetingUtilities.NonEditResponseInternal(responseType, calendarItemBase, sendResponse);
     if (meetingRequest != null)
     {
         MeetingUtilities.DeleteMeetingRequestAfterResponse(meetingRequest);
     }
 }
Ejemplo n.º 7
0
        public static MeetingResponse EditResponse(ResponseType responseType, MeetingRequest meetingRequest)
        {
            if (meetingRequest == null)
            {
                throw new ArgumentNullException("meetingRequest");
            }
            MeetingUtilities.ThrowIfMeetingResponseInvalid(meetingRequest);
            MeetingResponse result;

            using (CalendarItemBase calendarItemBase = MeetingUtilities.UpdateCalendarItem(meetingRequest))
            {
                result = MeetingUtilities.EditResponseInternal(responseType, calendarItemBase);
            }
            return(result);
        }
Ejemplo n.º 8
0
        public static CalendarItemBase TryPreProcessCalendarItem(MeetingMessage meetingMessage, UserContext userContext, bool doCalendarItemSave)
        {
            if (meetingMessage == null)
            {
                throw new ArgumentNullException("meetingMessage");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            CalendarItemBase calendarItemBase = null;

            meetingMessage.OpenAsReadWrite();
            try
            {
                ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Retreiving calendar item associated with meeting request. Value = '{0}'", (meetingMessage.Id != null) ? meetingMessage.Id.ObjectId.ToBase64String() : "null");
                calendarItemBase = meetingMessage.PreProcess(userContext.CalendarSettings.AddNewRequestsTentatively, userContext.CalendarSettings.ProcessExternalMeetingMessages, userContext.CalendarSettings.DefaultReminderTime);
                if (doCalendarItemSave && calendarItemBase != null)
                {
                    Utilities.ValidateCalendarItemBaseStoreObject(calendarItemBase);
                }
                if (meetingMessage.IsDirty)
                {
                    MeetingUtilities.SaveItem(meetingMessage, new PropertyDefinition[0]);
                }
            }
            catch (CorrelationFailedException ex)
            {
                ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Calendar item associated with meeting request could not be found.  Exception: {0}", ex.Message);
            }
            catch (CalendarProcessingException ex2)
            {
                ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Calendar item associated with meeting request could not be found.  Exception: {0}", ex2.Message);
            }
            catch (StoragePermanentException ex3)
            {
                ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Calendar item associated with meeting request could not be found.  Exception: {0}", ex3.Message);
            }
            catch (ConnectionFailedTransientException innerException)
            {
                throw new OwaAccessDeniedException(LocalizedStrings.GetNonEncoded(995407892), innerException);
            }
            return(calendarItemBase);
        }
Ejemplo n.º 9
0
        public static SanitizedHtmlString GetAttendeeResponseCountMessage(CalendarItemBase calendarItemBase)
        {
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            foreach (Attendee attendee in calendarItemBase.AttendeeCollection)
            {
                switch (attendee.ResponseType)
                {
                case ResponseType.Tentative:
                    num2++;
                    break;

                case ResponseType.Accept:
                    num++;
                    break;

                case ResponseType.Decline:
                    num3++;
                    break;
                }
            }
            SanitizedHtmlString result;

            if (num == 0 && num2 == 0 && num3 == 0)
            {
                result = SanitizedHtmlString.FromStringId(-518767563);
            }
            else
            {
                string response  = MeetingUtilities.GetResponse(num, LocalizedStrings.GetNonEncoded(-1438005858), LocalizedStrings.GetNonEncoded(-171859085), Strings.MoreThenOneAttendeeAccepted);
                string response2 = MeetingUtilities.GetResponse(num2, LocalizedStrings.GetNonEncoded(-409971733), LocalizedStrings.GetNonEncoded(-1184021704), Strings.MoreThenOneAttendeeTentativelyAccepted);
                string response3 = MeetingUtilities.GetResponse(num3, LocalizedStrings.GetNonEncoded(161551623), LocalizedStrings.GetNonEncoded(1194482770), Strings.MoreThenOneAttendeeDeclined);
                result = SanitizedHtmlString.Format(LocalizedStrings.GetNonEncoded(-1080172631), new object[]
                {
                    response,
                    response2,
                    response3
                });
            }
            return(result);
        }
Ejemplo n.º 10
0
        private static MeetingResponse CreateMeetingResponse(ResponseType responseType, CalendarItemBase calendarItemBase, bool intendToSendResponse)
        {
            MeetingResponse meetingResponse = null;

            try
            {
                meetingResponse = calendarItemBase.RespondToMeetingRequest(responseType, true, intendToSendResponse, null, null);
                calendarItemBase.Load();
                if (Globals.ArePerfCountersEnabled)
                {
                    OwaSingleCounters.ItemsCreated.Increment();
                }
                MeetingUtilities.UpdateMeetingResponseSubject(meetingResponse);
            }
            catch (SaveConflictException ex)
            {
                ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Exception on RespondToMeetingRequest: {0}'", ex.Message);
                throw;
            }
            return(meetingResponse);
        }
Ejemplo n.º 11
0
        public static CalendarItemBase UpdateCalendarItem(MeetingRequest meetingRequest)
        {
            if (meetingRequest == null)
            {
                throw new ArgumentNullException("meetingRequest");
            }
            MeetingUtilities.ThrowIfMeetingResponseInvalid(meetingRequest);
            CalendarItemBase calendarItemBase = null;

            try
            {
                try
                {
                    ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Retreiving calendar item associated with meeting request. Value = '{0}'", (meetingRequest.Id != null && meetingRequest.Id.ObjectId != null) ? meetingRequest.Id.ObjectId.ToBase64String() : "null");
                    if (meetingRequest.IsOutOfDate())
                    {
                        throw new OwaOperationNotSupportedException(LocalizedStrings.GetNonEncoded(-1085726012));
                    }
                    calendarItemBase = meetingRequest.UpdateCalendarItem(true);
                    if (calendarItemBase == null)
                    {
                        throw new OwaInvalidOperationException("meetingRequest.UpdateCalendarItem returns null.");
                    }
                    calendarItemBase.Load();
                }
                catch (CorrelationFailedException ex)
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Calendar item associated with meeting request could not be found.  Exception: {0}", ex.Message);
                    throw;
                }
                catch (StoragePermanentException ex2)
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Calendar item associated with meeting request could not be found.  Exception: {0}", ex2.Message);
                    throw;
                }
                catch (InvalidOperationException ex3)
                {
                    if (ex3.Message == ServerStrings.ExOrganizerCannotCallUpdateCalendarItem)
                    {
                        throw new OwaOperationNotSupportedException(LocalizedStrings.GetNonEncoded(679811893));
                    }
                    throw;
                }
                try
                {
                    MeetingUtilities.SaveItem(meetingRequest, new PropertyDefinition[]
                    {
                        MeetingMessageSchema.CalendarProcessed,
                        StoreObjectSchema.ParentItemId
                    });
                }
                catch (OwaSaveConflictException ex4)
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Calendar item associated with meeting request could not be saved.  Exception: {0}", ex4.Message);
                    throw;
                }
            }
            catch
            {
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
                throw;
            }
            if (Globals.ArePerfCountersEnabled)
            {
                OwaSingleCounters.ItemsCreated.Increment();
            }
            return(calendarItemBase);
        }
Ejemplo n.º 12
0
        public static void DeleteMeetingMessageCalendarItem(StoreObjectId meetingMessageId)
        {
            if (meetingMessageId == null)
            {
                throw new ArgumentNullException("meetingRequestId");
            }
            MeetingMessage   meetingMessage   = null;
            CalendarItemBase calendarItemBase = null;
            UserContext      userContext      = UserContextManager.GetUserContext();

            try
            {
                try
                {
                    meetingMessage = (MeetingMessage)Item.Bind(userContext.MailboxSession, meetingMessageId, ItemBindOption.LoadRequiredPropertiesOnly);
                }
                catch (ObjectNotFoundException)
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug(0L, "Meeting request could not be found.");
                    throw;
                }
                calendarItemBase = MeetingUtilities.TryGetCorrelatedItem(meetingMessage);
                if (calendarItemBase != null)
                {
                    if (!calendarItemBase.IsOrganizer())
                    {
                        MeetingRequest meetingRequest = meetingMessage as MeetingRequest;
                        if (meetingRequest != null)
                        {
                            if (meetingRequest.MeetingRequestType == MeetingMessageType.InformationalUpdate || meetingRequest.MeetingRequestType == MeetingMessageType.Outdated || calendarItemBase.ResponseType == ResponseType.Accept || calendarItemBase.ResponseType == ResponseType.Tentative)
                            {
                                return;
                            }
                        }
                        else
                        {
                            if (!(meetingMessage is MeetingCancellation))
                            {
                                throw new OwaInvalidRequestException("Meeting message must be either a meeting invite or meeting cancellation");
                            }
                            if (meetingMessage.IsOutOfDate(calendarItemBase))
                            {
                                return;
                            }
                        }
                        calendarItemBase.DeleteMeeting(DeleteItemFlags.MoveToDeletedItems);
                    }
                }
            }
            finally
            {
                if (meetingMessage != null)
                {
                    meetingMessage.Dispose();
                    meetingMessage = null;
                }
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
            }
        }