Пример #1
0
        internal static List <MeetingData> GetCorrelatedMeetings(MailboxSession session, UserObject mailboxUser, StoreId meetingId)
        {
            List <MeetingData> list = new List <MeetingData>();

            using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(session, meetingId, CalendarQuery.CalendarQueryProps))
            {
                MeetingData item = MeetingData.CreateInstance(mailboxUser, calendarItemBase);
                list.Add(item);
                if (calendarItemBase.CalendarItemType == CalendarItemType.RecurringMaster)
                {
                    try
                    {
                        IList <OccurrenceInfo> modifiedOccurrences = (calendarItemBase as CalendarItem).Recurrence.GetModifiedOccurrences();
                        foreach (OccurrenceInfo occurrenceInfo in modifiedOccurrences)
                        {
                            MeetingData item2 = MeetingData.CreateInstance(mailboxUser, occurrenceInfo.VersionedId, calendarItemBase.GlobalObjectId, CalendarItemType.Exception);
                            list.Add(item2);
                        }
                    }
                    catch (RecurrenceFormatException)
                    {
                    }
                }
            }
            return(list);
        }
Пример #2
0
 private static List <MeetingData> GetDuplicates(MeetingData meeting, List <MeetingData> meetings)
 {
     if (meetings.Count <= 1)
     {
         return(null);
     }
     return(meetings.FindAll((MeetingData meetingToCheck) => meeting.CalendarItemType == meetingToCheck.CalendarItemType && meeting.GlobalObjectId != null && meetingToCheck.GlobalObjectId != null && GlobalObjectId.Equals(meetingToCheck.GlobalObjectId, meeting.GlobalObjectId)));
 }
Пример #3
0
 internal static MeetingComparisonResult CreateInstance(UserObject attendee, MeetingData meeting)
 {
     return(new MeetingComparisonResult
     {
         CheckResultList = new List <ConsistencyCheckResult>(),
         RepairInfo = RepairSteps.CreateInstance(),
         AttendeePrimarySmtpAddress = ((attendee.ExchangePrincipal == null) ? attendee.EmailAddress : attendee.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString()),
         Meeting = meeting
     });
 }
Пример #4
0
        internal static MeetingValidationResult GetMVResultWithMoreCalItemData(MailboxSession session, UserObject mailboxUser, StoreId id, string errorString, string subject, ExDateTime rangeStart, ExDateTime rangeEnd)
        {
            MeetingValidationResult result = null;

            try
            {
                using (MessageItem messageItem = Item.BindAsMessage(session, id, CalendarQuery.CalendarQueryProps))
                {
                    MeetingData meetingData = MeetingData.CreateInstance(mailboxUser, messageItem);
                    if (!string.IsNullOrEmpty(meetingData.InternetMessageId))
                    {
                        errorString += string.Format(", InternetMessageId = {0}", meetingData.InternetMessageId);
                    }
                    result = new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData, false, errorString);
                }
            }
            catch (Exception arg)
            {
                errorString = string.Format("GetMVResultWithMoreCalItemData: Could not re-open as a message, Subject=\"{0}\", Original Error Message:\"{1}\", Exception = {2}", subject, errorString, arg);
                MeetingData meetingData2 = MeetingData.CreateInstance(mailboxUser, id);
                result = new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData2, false, errorString);
            }
            return(result);
        }
Пример #5
0
        internal static List <MeetingData> GetMeetingsInRange(MailboxSession session, UserObject mailboxUser, CalendarFolder calendarFolder, ExDateTime rangeStart, ExDateTime rangeEnd, string locationToFilterWith, string subjectToFilterWith, List <MeetingValidationResult> results)
        {
            object[][]         array   = null;
            List <MeetingData> list    = new List <MeetingData>();
            HashSet <StoreId>  hashSet = new HashSet <StoreId>();

            if (results == null)
            {
                return(list);
            }
            array = CalendarQuery.GetRecurringMasters(calendarFolder, CalendarQuery.CalendarQueryProps);
            foreach (object[] array3 in array)
            {
                if (!ObjectClass.IsCalendarItemSeries((string)array3[29]))
                {
                    string text;
                    if (!CalendarQuery.ArePropertiesValid(array3, out text))
                    {
                        StoreId     storeId     = (StoreId)array3[0];
                        MeetingData meetingData = MeetingData.CreateInstance(mailboxUser, storeId);
                        results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData, false, text));
                    }
                    else
                    {
                        string location = (string)array3[8];
                        string text2    = (string)array3[9];
                        if (CalendarQuery.ShouldContinueLocationSubjectFilters(locationToFilterWith, subjectToFilterWith, location, text2))
                        {
                            StoreId storeId = (StoreId)array3[0];
                            bool    flag    = (bool)array3[3];
                            if (flag)
                            {
                                CalendarItem calendarItem = null;
                                string       empty        = string.Empty;
                                try
                                {
                                    calendarItem = CalendarItem.Bind(session, storeId, CalendarQuery.CalendarQueryProps);
                                    if (calendarItem.Recurrence != null)
                                    {
                                        IList <OccurrenceInfo> modifiedOccurrences = calendarItem.Recurrence.GetModifiedOccurrences();
                                        foreach (OccurrenceInfo occurrenceInfo in modifiedOccurrences)
                                        {
                                            StoreId versionedId = occurrenceInfo.VersionedId;
                                            hashSet.Add(versionedId);
                                        }
                                        OccurrenceInfo firstOccurrence;
                                        OccurrenceInfo occurrenceInfo2;
                                        try
                                        {
                                            firstOccurrence = calendarItem.Recurrence.GetFirstOccurrence();
                                            if (calendarItem.Recurrence.Range is NoEndRecurrenceRange)
                                            {
                                                occurrenceInfo2 = null;
                                            }
                                            else
                                            {
                                                occurrenceInfo2 = calendarItem.Recurrence.GetLastOccurrence();
                                            }
                                        }
                                        catch (RecurrenceHasNoOccurrenceException)
                                        {
                                            goto IL_350;
                                        }
                                        catch (InvalidOperationException)
                                        {
                                            MeetingData meetingData2 = MeetingData.CreateInstance(mailboxUser, storeId);
                                            results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData2, false, string.Format("GetMeetingsInRange: InvalidOperationException: no end occurence, Subject=\"{0}\"", text2)));
                                            goto IL_350;
                                        }
                                        if ((occurrenceInfo2 == null || !(occurrenceInfo2.StartTime < rangeStart)) && !(firstOccurrence.EndTime >= rangeEnd))
                                        {
                                            QueryResultPropertyBag queryResultPropertyBag = new QueryResultPropertyBag(session, CalendarQuery.CalendarQueryProps);
                                            queryResultPropertyBag.SetQueryResultRow(array3);
                                            MeetingData item = MeetingData.CreateInstance(mailboxUser, calendarItem);
                                            list.Add(item);
                                            foreach (OccurrenceInfo occurrenceInfo3 in modifiedOccurrences)
                                            {
                                                if (!(occurrenceInfo3.StartTime > rangeEnd) && !(occurrenceInfo3.StartTime < rangeStart))
                                                {
                                                    MeetingData item2 = MeetingData.CreateInstance(mailboxUser, occurrenceInfo3.VersionedId, calendarItem.GlobalObjectId, CalendarItemType.Exception);
                                                    list.Add(item2);
                                                }
                                            }
                                        }
                                    }
                                }
                                catch (RecurrenceFormatException exception)
                                {
                                    MeetingData item3 = MeetingData.CreateInstance(mailboxUser, storeId, null, exception);
                                    list.Add(item3);
                                }
                                catch (ObjectNotFoundException exception2)
                                {
                                    MeetingData meetingData3 = MeetingData.CreateInstance(mailboxUser, storeId, null, exception2);
                                    list.Add(meetingData3);
                                    results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData3, false, string.Format("GetMeetingsInRange: ObjectNotFoundException - could not find this meeting, Subject=\"{0}\"", text2)));
                                }
                                catch (CorruptDataException arg)
                                {
                                    text = string.Format("GetMeetingsInRange: Subject=\"{0}\", CorruptDataException: {1}", text2, arg);
                                    MeetingValidationResult mvresultWithMoreCalItemData = CalendarQuery.GetMVResultWithMoreCalItemData(session, mailboxUser, storeId, text, text2, rangeStart, rangeEnd);
                                    results.Add(mvresultWithMoreCalItemData);
                                }
                                catch (ArgumentException exception3)
                                {
                                    MeetingData meetingData4 = MeetingData.CreateInstance(mailboxUser, storeId, null, exception3);
                                    list.Add(meetingData4);
                                    results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData4, false, string.Format("GetMeetingsInRange: ArgumentException - could not bind this meeting, Subject=\"{0}\"", text2)));
                                }
                                catch (AccessDeniedException arg2)
                                {
                                    MeetingData meetingData5 = MeetingData.CreateInstance(mailboxUser, storeId);
                                    results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData5, false, string.Format("GetMeetingsInRange:  AccessDeniedException: {0}", arg2)));
                                }
                                finally
                                {
                                    if (calendarItem != null)
                                    {
                                        calendarItem.Dispose();
                                    }
                                }
                            }
                        }
                    }
                }
                IL_350 :;
            }
            try
            {
                array = calendarFolder.GetCalendarView(rangeStart, rangeEnd, CalendarQuery.CalendarQueryProps);
            }
            catch (Exception arg3)
            {
                MeetingData meetingData6 = MeetingData.CreateInstance(mailboxUser, null);
                results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData6, false, string.Format("GetMeetingsInRange:  Exception: {0}", arg3)));
                return(list);
            }
            foreach (object[] array5 in array)
            {
                if (!ObjectClass.IsCalendarItemSeries((string)array5[29]))
                {
                    string errorDescription;
                    if (!CalendarQuery.ArePropertiesValid(array5, out errorDescription))
                    {
                        StoreId     storeId2     = (StoreId)array5[0];
                        MeetingData meetingData7 = MeetingData.CreateInstance(mailboxUser, storeId2);
                        results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData7, false, errorDescription));
                    }
                    else
                    {
                        string location2 = (string)array5[8];
                        string subject   = (string)array5[9];
                        if (CalendarQuery.ShouldContinueLocationSubjectFilters(locationToFilterWith, subjectToFilterWith, location2, subject))
                        {
                            StoreId storeId2 = (StoreId)array5[0];
                            bool    flag2    = (bool)array5[3];
                            if (flag2)
                            {
                                byte[]         array6 = (byte[])array5[1];
                                GlobalObjectId globalObjectId;
                                try
                                {
                                    globalObjectId = new GlobalObjectId(array6);
                                }
                                catch (CorruptDataException arg4)
                                {
                                    MeetingData meetingData8 = MeetingData.CreateInstance(mailboxUser, storeId2);
                                    results.Add(new MeetingValidationResult(rangeStart, rangeEnd, mailboxUser, meetingData8, false, string.Format("GetMeetingsInRange: CorruptDataException: The Global Object ID is invalid ({0}). Error: {1}", GlobalObjectId.ByteArrayToHexString(array6), arg4)));
                                    goto IL_54A;
                                }
                                int value = (int)array5[30];
                                CalendarItemType calendarItemType = (CalendarItemType)array5[5];
                                if (calendarItemType == CalendarItemType.Single)
                                {
                                    int         appointmentSequenceNumber = (int)array5[15];
                                    ExDateTime  lastModifiedTime          = (ExDateTime)array5[14];
                                    ExDateTime  ownerCriticalChangeTime   = (ExDateTime)array5[17];
                                    int         documentId = (int)array5[33];
                                    MeetingData item4      = MeetingData.CreateInstance(mailboxUser, storeId2, globalObjectId, appointmentSequenceNumber, lastModifiedTime, ownerCriticalChangeTime, CalendarItemType.Single, subject, new int?(value), documentId);
                                    list.Add(item4);
                                }
                                else if (calendarItemType == CalendarItemType.Exception)
                                {
                                    if (!hashSet.Contains(storeId2))
                                    {
                                        MeetingData item5 = MeetingData.CreateInstance(mailboxUser, storeId2, globalObjectId, CalendarItemType.Exception);
                                        list.Add(item5);
                                    }
                                }
                                else if (calendarItemType == CalendarItemType.Occurrence)
                                {
                                    MeetingData item6 = MeetingData.CreateInstance(mailboxUser, storeId2, globalObjectId, CalendarItemType.Occurrence);
                                    list.Add(item6);
                                }
                            }
                        }
                    }
                }
                IL_54A :;
            }
            return(list);
        }
 internal MeetingValidationResult(ExDateTime intervalStartDate, ExDateTime intervalEndDate, UserObject mailboxUser, MeetingData meetingDataKept, List <MeetingValidationResult> duplicates) : this()
 {
     this.numberOfDelegates  = mailboxUser.ExchangePrincipal.Delegates.Count <ADObjectId>();
     this.meetingData        = meetingDataKept;
     this.duplicatesDetected = true;
     this.intervalStartDate  = intervalStartDate;
     this.DuplicateResults   = duplicates;
 }
 internal MeetingValidationResult(ExDateTime intervalStartDate, ExDateTime intervalEndDate, UserObject mailboxUser, MeetingData meetingData, bool duplicatesDetected, string errorDescription) : this()
 {
     this.numberOfDelegates  = mailboxUser.ExchangePrincipal.Delegates.Count <ADObjectId>();
     this.meetingData        = meetingData;
     this.duplicatesDetected = duplicatesDetected;
     this.intervalStartDate  = intervalStartDate;
     this.intervalEndDate    = intervalEndDate;
     this.errorDescription   = errorDescription;
 }