Exemple #1
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);
        }
Exemple #2
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);
        }