예제 #1
0
        // Token: 0x060002D5 RID: 725 RVA: 0x000115C4 File Offset: 0x0000F7C4
        private void BuildListOfProvisionedFolders()
        {
            VersionedId rootFolderId = null;
            string      text         = null;

            using (Folder folder = Folder.Bind(this.MailboxSession, DefaultFolderType.Root, FolderProcessor.DataColumns))
            {
                rootFolderId = folder.Id;
                try
                {
                    if (ElcMailboxHelper.Exists(folder[FolderSchema.ELCPolicyIds]))
                    {
                        text = (string)folder[FolderSchema.ELCPolicyIds];
                        List <object> list = new List <object>(folder.GetProperties(FolderProcessor.DataColumns));
                        list.Add(list[3]);
                        this.entireFolderList.Add(list.ToArray());
                        FolderProcessor.Tracer.TraceDebug <FolderProcessor, string>((long)this.GetHashCode(), "{0}: Root Policy '{1}' is set for this mailbox.", this, text);
                    }
                }
                catch (PropertyErrorException ex)
                {
                    if (ex.PropertyErrors[0].PropertyErrorCode != PropertyErrorCode.NotFound)
                    {
                        throw;
                    }
                    FolderProcessor.Tracer.TraceDebug <FolderProcessor>((long)this.GetHashCode(), "{0}: Root Policy does not exist for this mailbox.", this);
                }
                using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, FolderProcessor.DataColumns))
                {
                    for (;;)
                    {
                        object[][] rows = queryResult.GetRows(100);
                        if (rows.Length <= 0)
                        {
                            break;
                        }
                        for (int i = 0; i < rows.Length; i++)
                        {
                            this.entireFolderList.Add(rows[i]);
                        }
                    }
                }
            }
            ElcMailboxHelper.PopulateFolderPathProperty(this.entireFolderList, new FolderPathIndices(3, 6, 0, 1, 7));
            for (int j = 0; j < this.entireFolderList.Count; j++)
            {
                ProvisionedFolder provisionedFolder = this.GetProvisionedFolder(j, rootFolderId, text);
                if (provisionedFolder != null)
                {
                    this.ProvisionedFolderList.Add(provisionedFolder);
                }
            }
            FolderProcessor.Tracer.TraceDebug <FolderProcessor, int>((long)this.GetHashCode(), "{0}: Number of folders found with policies for this mailbox is: {1}.", this, this.ProvisionedFolderList.Count);
        }
        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);
        }