Beispiel #1
0
        public MruFolderList(UserContext userContext)
        {
            PropertyDefinition[] propsToReturn = new PropertyDefinition[]
            {
                FolderSchema.DisplayName,
                FolderSchema.ItemCount,
                FolderSchema.UnreadCount,
                FolderSchema.ExtendedFolderFlags
            };
            FolderMruCache cacheInstance = FolderMruCache.GetCacheInstance(userContext);

            if (cacheInstance != null)
            {
                cacheInstance.Sort();
                int num = 0;
                while (num < cacheInstance.CacheLength && num < this.folderItems.Length)
                {
                    StoreObjectId folderId = cacheInstance.CacheEntries[num].FolderId;
                    Folder        folder   = null;
                    try
                    {
                        folder = Folder.Bind(userContext.MailboxSession, folderId, propsToReturn);
                    }
                    catch (ObjectNotFoundException)
                    {
                        FolderMruCache.DeleteFromCache(folderId, userContext);
                        cacheInstance = FolderMruCache.GetCacheInstance(userContext);
                        cacheInstance.Sort();
                        int entryIndexByFolderId = cacheInstance.GetEntryIndexByFolderId(folderId);
                        if (entryIndexByFolderId != -1)
                        {
                            num++;
                        }
                        continue;
                    }
                    int i;
                    for (i = 0; i < this.folderItemCount; i++)
                    {
                        if (string.CompareOrdinal(folder.DisplayName, this.folderItems[i].DisplayName) < 0)
                        {
                            for (int j = this.folderItemCount - 1; j >= i; j--)
                            {
                                if (j + 1 < this.folderItems.Length)
                                {
                                    this.folderItems[j + 1] = this.folderItems[j];
                                }
                            }
                            break;
                        }
                    }
                    this.folderItems[i] = new MruFolderItem(folderId, folder.DisplayName, folder.ItemCount, (int)folder.TryGetProperty(FolderSchema.UnreadCount), folder.TryGetProperty(FolderSchema.ExtendedFolderFlags));
                    this.folderItemCount++;
                    folder.Dispose();
                    num++;
                }
            }
        }
Beispiel #2
0
 private void UpdateMru(StoreObjectId folderId)
 {
     if (string.CompareOrdinal(Utilities.GetQueryStringParameter(base.Request, "mru", false), "1") == 0)
     {
         string className = base.Folder.ClassName;
         bool   flag      = true;
         if (string.IsNullOrEmpty(className) || string.CompareOrdinal(className, "IPF.Note") == 0)
         {
             flag = false;
         }
         DefaultFolderType defaultFolderType = Utilities.GetDefaultFolderType(base.Folder);
         if (defaultFolderType == DefaultFolderType.Inbox || defaultFolderType == DefaultFolderType.DeletedItems || defaultFolderType == DefaultFolderType.Drafts || defaultFolderType == DefaultFolderType.JunkEmail || defaultFolderType == DefaultFolderType.SentItems)
         {
             flag = true;
         }
         if (!flag)
         {
             FolderMruCache      cacheInstance = FolderMruCache.GetCacheInstance(base.UserContext);
             FolderMruCacheEntry newEntry      = new FolderMruCacheEntry(folderId);
             cacheInstance.AddEntry(newEntry);
             cacheInstance.Commit();
         }
     }
 }
        // Token: 0x060001ED RID: 493 RVA: 0x00012C00 File Offset: 0x00010E00
        private PreFormActionResponse ExecuteDeleteAction()
        {
            StoreObjectId         storeObjectId = RequestParser.GetStoreObjectId(this.httpRequest, "ftd", true, ParameterIn.Form);
            int                   num           = RequestParser.TryGetIntValueFromQueryString(this.httpRequest, "hd", 0);
            bool                  flag          = this.folderManagementHelper.Delete(storeObjectId, num == 1);
            PreFormActionResponse result        = new PreFormActionResponse();

            if (flag && this.folderId.Equals(storeObjectId))
            {
                switch (this.module)
                {
                case NavigationModule.Mail:
                    this.folderId = this.userContext.InboxFolderId;
                    this.userContext.LastClientViewState = new MessageModuleViewState(this.userContext.InboxFolderId, "IPF.Note", SecondaryNavigationArea.Special, 1);
                    break;

                case NavigationModule.Calendar:
                    this.folderId = this.userContext.CalendarFolderId;
                    this.userContext.LastClientViewState = new CalendarModuleViewState(this.userContext.CalendarFolderId, "IPF.Appointment", DateTimeUtilities.GetLocalTime().Date);
                    break;

                case NavigationModule.Contacts:
                    this.folderId = this.userContext.ContactsFolderId;
                    this.userContext.LastClientViewState = new ContactModuleViewState(this.userContext.ContactsFolderId, "IPF.Contact", 1);
                    break;

                default:
                    throw new OwaInvalidRequestException("Invalid module for folder management preformaction");
                }
            }
            if (flag)
            {
                FolderMruCache.DeleteFromCache(storeObjectId, this.userContext);
            }
            return(result);
        }