// Token: 0x060010EC RID: 4332 RVA: 0x000462C8 File Offset: 0x000444C8
        private CalendarViewQueryResumptionPoint DoQuerySync(HashSet <StoreId> syncItemsHashSet, List <SyncCalendarItemType> updatedItemsList, List <SyncCalendarItemType> recurrenceMastersWithInstances, Dictionary <StoreId, SyncCalendarItemType> unchangedRecurrenceMastersWithInstances, ExDateTime queryWindowStart, ExDateTime queryWindowEnd, int maxCount, IList <KeyValuePair <StoreId, LocalizedException> > caughtExceptions, out int addedItems)
        {
            ExTraceGlobals.SyncCalendarTracer.TraceDebug((long)this.GetHashCode(), "XsoSyncCalendar.DoQuerySync: Start");
            int localAddedItems = 0;
            CalendarViewBatchingStrategy calendarViewBatchingStrategy = (this.syncState.QueryResumptionPoint == null) ? CalendarViewBatchingStrategy.CreateNewBatchingInstance(maxCount) : CalendarViewBatchingStrategy.CreateResumingInstance(maxCount, this.syncState.QueryResumptionPoint);

            using (CalendarFolder calendarFolder = CalendarFolder.Bind(this.session, this.folderId))
            {
                PropertyDefinition[] xsoRequiredProperties = this.getPropertiesToFetchDelegate(calendarFolder);
                object[][]           syncView = calendarFolder.GetSyncView(queryWindowStart, queryWindowEnd, calendarViewBatchingStrategy, xsoRequiredProperties, false);
                object[][]           array    = syncView;
                for (int i = 0; i < array.Length; i++)
                {
                    object[] itemRow = array[i];
                    try
                    {
                        GrayException.MapAndReportGrayExceptions(delegate()
                        {
                            ExDateTime t;
                            SyncCalendarItemType typedItem = this.GetTypedItem(xsoRequiredProperties, itemRow, out t);
                            if (typedItem.CalendarItemType != CalendarItemType.RecurringMaster)
                            {
                                if (this.windowStart == queryWindowStart || t >= queryWindowStart)
                                {
                                    localAddedItems += this.AddSyncItem(typedItem, updatedItemsList, syncItemsHashSet, unchangedRecurrenceMastersWithInstances, false);
                                }
                                return;
                            }
                            bool flag = false;
                            if (this.windowStart == queryWindowStart)
                            {
                                flag = true;
                            }
                            else
                            {
                                using (CalendarItem calendarItem = CalendarItem.Bind(this.session, typedItem.ItemId))
                                {
                                    IList <OccurrenceInfo> occurrenceInfoList = calendarItem.Recurrence.GetOccurrenceInfoList(this.windowStart, queryWindowStart);
                                    flag = (occurrenceInfoList.Count == 0);
                                }
                            }
                            if (flag)
                            {
                                localAddedItems += this.AddSyncItem(typedItem, recurrenceMastersWithInstances, syncItemsHashSet, unchangedRecurrenceMastersWithInstances, false);
                                return;
                            }
                            localAddedItems += this.AddSyncItem(typedItem, null, syncItemsHashSet, unchangedRecurrenceMastersWithInstances, true);
                        }, new GrayException.IsGrayExceptionDelegate(GrayException.IsSystemGrayException));
                    }
                    catch (LocalizedException ex)
                    {
                        StoreId storeId = (StoreId)itemRow[0];
                        ExTraceGlobals.SyncCalendarTracer.TraceWarning <string, LocalizedException>((long)this.GetHashCode(), "XsoSyncCalendar.DoQuerySync: Exception thrown while processing item {0}: {1}", storeId.ToBase64String(), ex);
                        caughtExceptions.Add(new KeyValuePair <StoreId, LocalizedException>(storeId, ex));
                    }
                }
            }
            ExTraceGlobals.SyncCalendarTracer.TraceDebug((long)this.GetHashCode(), "XsoSyncCalendar.DoQuerySync: End");
            addedItems = localAddedItems;
            return(calendarViewBatchingStrategy.ResumptionPoint);
        }
Exemplo n.º 2
0
        public virtual IEnumerable <Event> GetCalendarView(ExDateTime startTime, ExDateTime endTime, bool includeSeriesMasters, params Microsoft.Exchange.Data.PropertyDefinition[] propertiesToLoad)
        {
            IEnumerable <Event> result;

            using (ICalendarFolder calendarFolder = base.XsoFactory.BindToCalendarFolder(base.Session, base.ContainerFolderId))
            {
                Dictionary <Microsoft.Exchange.Data.PropertyDefinition, int> propertyIndices = this.GetPropertyIndices(propertiesToLoad);
                object[][]          syncView   = calendarFolder.GetSyncView(startTime, endTime, CalendarViewBatchingStrategy.CreateNoneBatchingInstance(), propertiesToLoad, true);
                IEnumerable <Event> enumerable = this.ReadQueryResults(syncView, propertyIndices);
                result = (includeSeriesMasters ? enumerable : this.FilterOutType(enumerable, EventType.SeriesMaster));
            }
            return(result);
        }