コード例 #1
0
        // Token: 0x06001ADA RID: 6874 RVA: 0x0009ADB4 File Offset: 0x00098FB4
        protected void Load(CalendarFolderDataSourceBase.GetPropertiesDelegate getProperties)
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, "CalendarFolderDataSourceBase.Load");
            ExTraceGlobals.CalendarTracer.TraceDebug((long)this.GetHashCode(), "Calling XSO's GetCalendarView to do the calendar query");
            Stopwatch watch = Utilities.StartWatch();

            this.allData = getProperties(DateRange.GetMinStartTimeInRangeArray(this.dateRanges), DateRange.GetMaxEndTimeInRangeArray(this.dateRanges));
            Utilities.StopWatch(watch, "GetCalendarView");
            if (this.allData.Length == 0)
            {
                return;
            }
            this.viewData = new ArrayList(2 * this.dateRanges.Length);
            for (int i = 0; i < this.allData.Length; i++)
            {
                object obj = this.allData[i][(int)this.propertyIndexes[CalendarItemInstanceSchema.StartTime]];
                if (obj != null && !(obj is PropertyError) && obj is ExDateTime)
                {
                    ExDateTime exDateTime = (ExDateTime)obj;
                    obj = this.allData[i][(int)this.propertyIndexes[CalendarItemInstanceSchema.EndTime]];
                    if (obj != null && !(obj is PropertyError) && obj is ExDateTime)
                    {
                        ExDateTime exDateTime2 = (ExDateTime)obj;
                        if (exDateTime > exDateTime2)
                        {
                            ExTraceGlobals.CalendarDataTracer.TraceDebug(0L, "Skipping appointment with an end time earlier than a start time");
                        }
                        else
                        {
                            for (int j = 0; j < this.dateRanges.Length; j++)
                            {
                                if (this.dateRanges[j].Intersects(exDateTime, exDateTime2))
                                {
                                    this.viewData.Add(this.allData[i]);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        // Token: 0x06001E25 RID: 7717 RVA: 0x000AED6C File Offset: 0x000ACF6C
        public static FreeBusyQueryResult[] BatchLoadData(UserContext userContext, string[] smtpAddresses, StoreObjectId[] folderStoreIds, DateRange[] dateRanges)
        {
            if (smtpAddresses == null || smtpAddresses.Length == 0)
            {
                throw new ArgumentNullException("smtpAddresses");
            }
            if (dateRanges == null || dateRanges.Length == 0)
            {
                throw new ArgumentNullException("dateRanges");
            }
            ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, "GSCalendarDataSource.Load");
            AvailabilityQuery availabilityQuery = new AvailabilityQuery();

            availabilityQuery.MailboxArray  = new MailboxData[smtpAddresses.Length];
            availabilityQuery.ClientContext = ClientContext.Create(userContext.LogonIdentity.ClientSecurityContext, userContext.ExchangePrincipal.MailboxInfo.OrganizationId, OwaContext.TryGetCurrentBudget(), userContext.TimeZone, userContext.UserCulture, AvailabilityQuery.CreateNewMessageId());
            for (int i = 0; i < smtpAddresses.Length; i++)
            {
                availabilityQuery.MailboxArray[i]                    = new MailboxData();
                availabilityQuery.MailboxArray[i].Email              = new EmailAddress();
                availabilityQuery.MailboxArray[i].Email.Address      = smtpAddresses[i];
                availabilityQuery.MailboxArray[i].AssociatedFolderId = folderStoreIds[i];
            }
            availabilityQuery.DesiredFreeBusyView = new FreeBusyViewOptions
            {
                TimeWindow = new Duration(),
                TimeWindow =
                {
                    StartTime = (DateTime)DateRange.GetMinStartTimeInRangeArray(dateRanges),
                    EndTime   = (DateTime)DateRange.GetMaxEndTimeInRangeArray(dateRanges)
                },
                MergedFreeBusyIntervalInMinutes = userContext.UserOptions.HourIncrement,
                RequestedView = FreeBusyViewType.Detailed
            };
            AvailabilityQueryResult availabilityQueryResult = Utilities.ExecuteAvailabilityQuery(availabilityQuery);

            if (availabilityQueryResult == null)
            {
                return(null);
            }
            return(availabilityQueryResult.FreeBusyResults);
        }