Exemple #1
0
        // Token: 0x06000F5F RID: 3935 RVA: 0x0003BBE0 File Offset: 0x00039DE0
        public static ItemType[] GetItemDataFromSearchFolder(OwaSearchContext searchContext, MailboxSession mailboxSession, out int totalRowCount)
        {
            List <ItemType> list = new List <ItemType>(50);

            totalRowCount = 0;
            StoreId searchFolderId = searchContext.SearchFolderId;

            SortBy[] searchSortBy = searchContext.SearchSortBy;
            using (SearchFolder searchFolder = SearchFolder.Bind(mailboxSession, searchFolderId))
            {
                int rowCount = 25;
                using (QueryResult queryResult = searchFolder.ItemQuery(ItemQueryType.None, null, searchSortBy, SearchFolderItemDataRetriever.itemSearchPropertyDefinitions))
                {
                    bool flag = true;
                    while (flag)
                    {
                        object[][] rows = queryResult.GetRows(rowCount, out flag);
                        if (rows == null || rows.Length == 0)
                        {
                            break;
                        }
                        for (int i = 0; i < rows.Length; i++)
                        {
                            if (totalRowCount < 50)
                            {
                                ItemType itemFromDataRow = SearchFolderItemDataRetriever.GetItemFromDataRow(searchContext, mailboxSession, rows[i], SearchFolderItemDataRetriever.itemSearchPropertyDefinitionsOrderDictionary);
                                list.Add(itemFromDataRow);
                            }
                            totalRowCount++;
                        }
                    }
                }
            }
            return(list.ToArray());
        }
Exemple #2
0
 private void InitReminderTableSubscription()
 {
     if (this.reminderSub == null)
     {
         using (SearchFolder searchFolder = SearchFolder.Bind(this.mailboxSession, DefaultFolderType.Reminders))
         {
             SortBy[] sortColumns = new SortBy[]
             {
                 new SortBy(ItemSchema.ReminderIsSet, SortOrder.Descending),
                 new SortBy(ItemSchema.ReminderNextTime, SortOrder.Descending)
             };
             this.queryResultReminder = searchFolder.ItemQuery(ItemQueryType.None, null, sortColumns, RemindersRenderingUtilities.QueryProperties);
             this.queryResultReminder.GetRows(1);
             this.reminderSub = Subscription.Create(this.queryResultReminder, new NotificationHandler(this.HandleReminderNotification));
         }
     }
 }
        public static List <object[]> QueryReminders(ExDateTime actualizationTime, UserContext userContext)
        {
            List <object[]> list = new List <object[]>();

            object[][]       array            = null;
            ComparisonFilter comparisonFilter = new ComparisonFilter(ComparisonOperator.LessThan, ItemSchema.ReminderNextTime, actualizationTime.AddHours(24.0));

            if (userContext.IsPushNotificationsEnabled)
            {
                array = userContext.MapiNotificationManager.GetReminderRows(comparisonFilter, 100);
            }
            else
            {
                using (SearchFolder searchFolder = SearchFolder.Bind(userContext.MailboxSession, DefaultFolderType.Reminders))
                {
                    SortBy[] sortColumns = new SortBy[]
                    {
                        new SortBy(ItemSchema.ReminderIsSet, SortOrder.Descending),
                        new SortBy(ItemSchema.ReminderNextTime, SortOrder.Descending)
                    };
                    using (QueryResult queryResult = searchFolder.ItemQuery(ItemQueryType.None, null, sortColumns, RemindersRenderingUtilities.QueryProperties))
                    {
                        queryResult.SeekToCondition(SeekReference.OriginBeginning, comparisonFilter);
                        array = queryResult.GetRows(100);
                    }
                }
            }
            if (array == null)
            {
                return(list);
            }
            for (int i = 0; i < array.Length; i++)
            {
                bool itemProperty = RemindersRenderingUtilities.GetItemProperty <bool>(array[i], ItemSchema.ReminderIsSet, false);
                if (!itemProperty)
                {
                    break;
                }
                list.Add(array[i]);
                if (list.Count == 100)
                {
                    break;
                }
            }
            return(list);
        }
 private void SetUpRemindersSubscription(int currentRetryCount)
 {
     if (!base.UserContext.MailboxSessionLockedByCurrentThread())
     {
         throw new InvalidOperationException("UserContext lock should be acquired before calling this method ReminderNotificationHandler.SetUpRemindersSubscription");
     }
     try
     {
         using (SearchFolder searchFolder = SearchFolder.Bind(base.UserContext.MailboxSession, DefaultFolderType.Reminders))
         {
             base.QueryResult = searchFolder.ItemQuery(ItemQueryType.None, null, ReminderNotificationHandler.sorts, ReminderNotificationHandler.querySubscriptionProperties);
             base.QueryResult.GetRows(1);
             base.Subscription = Subscription.Create(base.QueryResult, new NotificationHandler(base.HandleNotification));
         }
     }
     catch (QueryInProgressException)
     {
         if (currentRetryCount >= 5)
         {
             throw;
         }
         this.SetUpRemindersSubscription(currentRetryCount + 1);
     }
 }
        // Token: 0x0600095D RID: 2397 RVA: 0x0003ED90 File Offset: 0x0003CF90
        public static IList <CalendarInfo> Load(ExDateTime creationRequestTime, ExTimeZone timeZoneAdjustment, MailboxSession session, StoreObjectId calFldrId, StorageWorkingHours workingHours, ExDateTime actualizationTime, ExDateTime endTime)
        {
            StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Reminders);

            if (defaultFolderId == null)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, string>((long)typeof(ReminderLoader).GetHashCode(), "cannot open reminder folder for user {0}, Time {1}", session.MailboxOwner, ExDateTime.GetNow(timeZoneAdjustment).ToLongTimeString());
                return(new CalendarInfo[0]);
            }
            List <CalendarInfo> list          = new List <CalendarInfo>();
            StoreObjectId       storeObjectId = calFldrId;

            if (calFldrId.IsFolderId && StoreObjectType.Folder != calFldrId.ObjectType)
            {
                storeObjectId = calFldrId.Clone();
                storeObjectId.UpdateItemType(StoreObjectType.Folder);
            }
            QueryFilter queryFilter = new AndFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ItemSchema.ReminderNextTime, actualizationTime),
                new ComparisonFilter(ComparisonOperator.LessThan, ItemSchema.ReminderNextTime, endTime),
                new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ReminderIsSet, true),
                new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ParentItemId, storeObjectId)
            });

            SortBy[] sortColumns = new SortBy[]
            {
                new SortBy(ItemSchema.ReminderNextTime, SortOrder.Ascending)
            };
            new Interval <ExDateTime>(actualizationTime, false, endTime, true);
            using (SearchFolder searchFolder = SearchFolder.Bind(session, defaultFolderId))
            {
                using (QueryResult queryResult = searchFolder.ItemQuery(ItemQueryType.None, queryFilter, sortColumns, CalendarInfo.InterestedProperties))
                {
                    ExDateTime exDateTime = ExDateTime.MinValue;
                    foreach (object[] propVals in queryResult.GetRows(100))
                    {
                        CalendarInfo calendarInfo = CalendarInfo.FromInterestedProperties(creationRequestTime, timeZoneAdjustment, session, true, propVals);
                        if (CalendarItemType.RecurringMaster == calendarInfo.CalendarItemType)
                        {
                            using (CalendarItem calendarItem = CalendarItem.Bind(session, calendarInfo.CalendarItemIdentity))
                            {
                                using (CalendarItemOccurrence calendarItemOccurrence = (CalendarItemOccurrence)calendarItem.Reminder.GetPertinentItem(actualizationTime))
                                {
                                    if (calendarItemOccurrence != null)
                                    {
                                        calendarInfo = CalendarInfo.FromCalendarItemBase(creationRequestTime, timeZoneAdjustment, calendarItemOccurrence);
                                    }
                                }
                            }
                        }
                        if (!(calendarInfo.ReminderTime < actualizationTime) && calendarInfo.IsInteresting(CalendarNotificationType.Reminder) && (workingHours == null || Utils.InWorkingHours(calendarInfo.StartTime, calendarInfo.EndTime, workingHours)))
                        {
                            if (ExDateTime.MinValue == exDateTime)
                            {
                                exDateTime = calendarInfo.ReminderTime;
                            }
                            else if (calendarInfo.ReminderTime > exDateTime)
                            {
                                break;
                            }
                            list.Add(calendarInfo);
                        }
                    }
                }
            }
            return(list.AsReadOnly());
        }