예제 #1
0
        public static void PopulateRetentionTypes(DropDownList ddlRetentionType)
        {
            Type typeFromHandle = typeof(ElcFolderType);

            foreach (object obj in Enum.GetValues(typeFromHandle))
            {
                ElcFolderType elcFolderType = (ElcFolderType)obj;
                if (elcFolderType != ElcFolderType.ManagedCustomFolder && elcFolderType != ElcFolderType.NonIpmRoot && elcFolderType != ElcFolderType.LegacyArchiveJournals && elcFolderType != ElcFolderType.All && elcFolderType != ElcFolderType.Personal && elcFolderType != ElcFolderType.RecoverableItems && elcFolderType != ElcFolderType.Contacts && elcFolderType != ElcFolderType.Tasks)
                {
                    string   value = LocalizedDescriptionAttribute.FromEnum(typeFromHandle, elcFolderType);
                    string   text  = elcFolderType.ToString();
                    ListItem item  = new ListItem(RtlUtil.ConvertToDecodedBidiString(value, RtlUtil.IsRtl), text);
                    ddlRetentionType.Items.Add(item);
                    if (elcFolderType == ElcFolderType.Inbox)
                    {
                        ddlRetentionType.SelectedValue = text;
                    }
                }
            }
        }
        private List <object[]> PopulateFolderRows(MailboxSession mailboxSession, ElcFolderType folderScope)
        {
            List <object[]> list = null;
            List <object[]> result;

            try
            {
                using (Folder rootFolder = GetMailboxFolderStatistics.GetRootFolder(mailboxSession, folderScope))
                {
                    if (rootFolder == null)
                    {
                        if (folderScope != ElcFolderType.ManagedCustomFolder)
                        {
                            base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.ErrorFailedToFindFolderInMailbox(folderScope.ToString())), ErrorCategory.ReadError, null);
                        }
                        else
                        {
                            base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.ErrorFailedToManagedFoldersInMailbox), ErrorCategory.ReadError, null);
                        }
                        result = list;
                    }
                    else
                    {
                        list = new List <object[]>();
                        if (folderScope != ElcFolderType.ManagedCustomFolder)
                        {
                            object[] array = new object[GetMailboxFolderStatistics.folderStatProps.Length];
                            array[1]  = rootFolder[GetMailboxFolderStatistics.folderStatProps[1]];
                            array[2]  = rootFolder[GetMailboxFolderStatistics.folderStatProps[2]];
                            array[4]  = rootFolder[GetMailboxFolderStatistics.folderStatProps[4]];
                            array[5]  = rootFolder[GetMailboxFolderStatistics.folderStatProps[5]];
                            array[6]  = rootFolder.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[6]);
                            array[0]  = rootFolder.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[0]);
                            array[7]  = rootFolder.TryGetProperty(FolderSchema.AdminFolderFlags);
                            array[9]  = rootFolder.TryGetProperty(StoreObjectSchema.ParentItemId);
                            array[8]  = rootFolder.TryGetProperty(FolderSchema.ELCPolicyIds);
                            array[13] = rootFolder.TryGetProperty(StoreObjectSchema.PolicyTag);
                            array[14] = rootFolder.TryGetProperty(StoreObjectSchema.ArchiveTag);
                            array[11] = rootFolder.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[11]);
                            array[12] = rootFolder.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[12]);
                            array[3]  = 0;
                            array[10] = rootFolder.TryGetProperty(StoreObjectSchema.CreationTime);
                            list.Add(array);
                        }
                        GetMailboxFolderStatistics.GetFolderHierarchy(rootFolder, list);
                        if (folderScope == ElcFolderType.All)
                        {
                            using (Folder rootFolder2 = GetMailboxFolderStatistics.GetRootFolder(mailboxSession, ElcFolderType.RecoverableItems))
                            {
                                if (rootFolder2 != null)
                                {
                                    object[] array2 = new object[GetMailboxFolderStatistics.folderStatProps.Length];
                                    array2[1]  = rootFolder2[GetMailboxFolderStatistics.folderStatProps[1]];
                                    array2[2]  = rootFolder2[GetMailboxFolderStatistics.folderStatProps[2]];
                                    array2[4]  = rootFolder2[GetMailboxFolderStatistics.folderStatProps[4]];
                                    array2[5]  = rootFolder2[GetMailboxFolderStatistics.folderStatProps[5]];
                                    array2[6]  = rootFolder2.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[6]);
                                    array2[0]  = rootFolder2.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[0]);
                                    array2[7]  = rootFolder2.TryGetProperty(FolderSchema.AdminFolderFlags);
                                    array2[9]  = rootFolder2.TryGetProperty(StoreObjectSchema.ParentItemId);
                                    array2[8]  = rootFolder2.TryGetProperty(FolderSchema.ELCPolicyIds);
                                    array2[13] = rootFolder2.TryGetProperty(StoreObjectSchema.PolicyTag);
                                    array2[14] = rootFolder2.TryGetProperty(StoreObjectSchema.ArchiveTag);
                                    array2[11] = rootFolder2.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[11]);
                                    array2[12] = rootFolder2.TryGetProperty(GetMailboxFolderStatistics.folderStatProps[12]);
                                    array2[3]  = 0;
                                    array2[10] = rootFolder2.TryGetProperty(StoreObjectSchema.CreationTime);
                                    list.Add(array2);
                                    GetMailboxFolderStatistics.GetFolderHierarchy(rootFolder2, list);
                                }
                            }
                        }
                        ElcMailboxHelper.PopulateFolderPathProperty(list, new FolderPathIndices(0, 3, 1, 9, 15));
                        result = list;
                    }
                }
            }
            catch (ObjectNotFoundException)
            {
                base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.ErrorFailedToFindFolderInMailbox(folderScope.ToString())), ErrorCategory.ReadError, null);
                result = null;
            }
            return(result);
        }