internal static CalendarEvent[] GetCalendarEvents(EmailAddress emailAddress, CalendarFolder calendarFolder, ExDateTime windowStart, ExDateTime windowEnd, FreeBusyViewType accessAllowed, bool canActAsMailboxOwner, ExchangeVersionType exchangeVersion) { CalendarEvent[] array = null; int num = 0; object[][] calendarView = calendarFolder.GetCalendarView(windowStart, windowEnd, InternalCalendarQuery.CalendarQueryProperties); InternalCalendarQuery.CalendarViewTracer.TraceDebug(0L, "{0}: Query for {1} found {2} appointment entries between {3} and {4}", new object[] { TraceContext.Get(), emailAddress, calendarView.Length, windowStart, windowEnd }); num += calendarView.Length; if (num > Configuration.MaximumResultSetSize) { LocalizedException ex = new ResultSetTooBigException(Configuration.MaximumResultSetSize, num); InternalCalendarQuery.CalendarViewTracer.TraceError <object, EmailAddress, LocalizedException>(0L, "{0}: Query for {1} got exception getting Calendar Data. Exception: {2}", TraceContext.Get(), emailAddress, ex); throw ex; } int length = calendarView.GetLength(0); if (length > 0) { array = new CalendarEvent[length]; for (int i = 0; i < length; i++) { object[] properties = calendarView[i]; array[i] = CalendarEvent.CreateFromQueryData(emailAddress, properties, accessAllowed, canActAsMailboxOwner, exchangeVersion); } } return(array); }
public CalendarDataSource(UserContext userContext, CalendarFolder folder, DateRange[] dateRanges, PropertyDefinition[] properties) : base(dateRanges, properties) { if (userContext == null) { throw new ArgumentNullException("userContext"); } if (folder == null) { throw new ArgumentNullException("folder"); } this.userContext = userContext; this.folder = folder; this.folderId = OwaStoreObjectId.CreateFromStoreObject(folder); base.Load((ExDateTime start, ExDateTime end) => folder.GetCalendarView(start, end, properties)); }
// Token: 0x0600095E RID: 2398 RVA: 0x0003F034 File Offset: 0x0003D234 public static IList <CalendarInfo> Load(ExDateTime creationRequestTime, ExTimeZone timeZoneAdjustment, MailboxSession session, StoreObjectId calFldrId, StorageWorkingHours workingHours, ExDateTime actualizationTime, ExDateTime endTime) { List <CalendarInfo> list = new List <CalendarInfo>(); using (CalendarFolder calendarFolder = CalendarFolder.Bind(session, calFldrId)) { foreach (object[] propVals in calendarFolder.GetCalendarView(actualizationTime, endTime, CalendarInfo.InterestedProperties)) { CalendarInfo calendarInfo = CalendarInfo.FromInterestedProperties(creationRequestTime, timeZoneAdjustment, session, true, propVals); if (calendarInfo.IsInteresting(CalendarNotificationType.Summary) && (workingHours == null || Utils.InWorkingHours(calendarInfo.StartTime, calendarInfo.EndTime, workingHours))) { list.Add(calendarInfo); } } } return(list.AsReadOnly()); }
public static VersionedId GetOccurrenceItemId(MailboxSession mailboxSession, ExDateTime startTime, ExDateTime endTime) { using (CalendarFolder calendarFolder = CalendarFolder.Bind(mailboxSession, DefaultFolderType.Calendar, null)) { object[][] calendarView = calendarFolder.GetCalendarView(startTime, endTime, new PropertyDefinition[] { ItemSchema.Id }); for (int i = 0; i < calendarView.Length; i++) { if (!(calendarView[i][0] is PropertyError)) { return((VersionedId)calendarView[i][0]); } } } return(null); }
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); }