public static void GetListForPickerPostAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            List <DataRow> list = new List <DataRow>();

            dataTable.BeginLoadData();
            foreach (object obj in dataTable.Rows)
            {
                DataRow       dataRow       = (DataRow)obj;
                ElcFolderType elcFolderType = (ElcFolderType)dataRow["Type"];
                if (elcFolderType == ElcFolderType.ManagedCustomFolder)
                {
                    list.Add(dataRow);
                }
                else
                {
                    EnhancedTimeSpan?ageLimitForRetention = dataRow["AgeLimitForRetention"].IsNullValue() ? null : ((EnhancedTimeSpan?)dataRow["AgeLimitForRetention"]);
                    dataRow["FolderType"]                = RetentionUtils.GetLocalizedType((ElcFolderType)dataRow["Type"]);
                    dataRow["RetentionDays"]             = RetentionPolicyTagPropertiesHelper.GetRetentionDays(ageLimitForRetention, (bool)dataRow["RetentionEnabled"]);
                    dataRow["RetentionPeriodDays"]       = RetentionPolicyTagPropertiesHelper.GetRetentionPeriodDays(ageLimitForRetention, (bool)dataRow["RetentionEnabled"]);
                    dataRow["RetentionPolicyActionType"] = RetentionUtils.GetLocalizedRetentionActionType((RetentionActionType)dataRow["RetentionAction"]);
                }
            }
            foreach (DataRow row in list)
            {
                dataTable.Rows.Remove(row);
            }
            dataTable.EndLoadData();
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         using (MailboxSession mailboxSession = this.OpenMailboxSession())
         {
             if (mailboxSession == null)
             {
                 base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.LogonFailure), ErrorCategory.ReadError, null);
             }
             else
             {
                 ElcFolderType   folderScope = (this.FolderScope != null) ? this.FolderScope.Value : ElcFolderType.All;
                 List <object[]> list        = this.PopulateFolderRows(mailboxSession, folderScope);
                 if (list == null || list.Count == 0)
                 {
                     base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.NoFoldersInMailbox), ErrorCategory.ReadError, null);
                 }
                 else
                 {
                     for (int i = 0; i < list.Count; i++)
                     {
                         object[] array = list[i];
                         if (GetMailboxFolderStatistics.PropertyExists(array[1]))
                         {
                             MailboxFolderConfiguration folderInformation = this.GetFolderInformation(i, list, mailboxSession, this.ConfigurationSession);
                             if (folderInformation != null)
                             {
                                 GetMailboxFolderStatistics.GetFolderSearchBacklinkNames(mailboxSession, (VersionedId)array[1], folderInformation);
                                 if (this.IncludeAnalysis)
                                 {
                                     GetMailboxFolderStatistics.GetAnalysis(mailboxSession, (VersionedId)array[1], folderInformation);
                                 }
                                 if (this.IncludeOldestAndNewestItems)
                                 {
                                     GetMailboxFolderStatistics.GetOldestAndNewestItem(mailboxSession, (VersionedId)array[1], folderInformation);
                                 }
                                 this.WriteResult(folderInformation);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (StorageTransientException ex)
     {
         base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), ex.ToString()), ErrorCategory.ReadError, null);
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
예제 #3
0
        public static string GetLocalizedType(ElcFolderType retentionTagType)
        {
            string result = LocalizedDescriptionAttribute.FromEnum(typeof(ElcFolderType), retentionTagType);

            if (retentionTagType != ElcFolderType.All)
            {
                if (retentionTagType == ElcFolderType.Personal)
                {
                    result = Strings.RetentionTagTypePersonal;
                }
            }
            else
            {
                result = Strings.RetentionTagTypeAll;
            }
            return(result);
        }
        private static string GetLocalizedType(ElcFolderType folderType)
        {
            string result = Strings.RetentionTagNewSystemFolder;

            if (folderType != ElcFolderType.All)
            {
                if (folderType == ElcFolderType.Personal)
                {
                    result = Strings.RetentionTagNewPersonal;
                }
            }
            else
            {
                result = Strings.RetentionTagNewAll;
            }
            return(result);
        }
 /// <summary>
 /// Constructor for retention policy tag.
 /// </summary>
 /// <param name="displayName">Display name.</param>
 /// <param name="retentionId">Retention id.</param>
 /// <param name="retentionPeriod">Retention period.</param>
 /// <param name="type">Retention folder type.</param>
 /// <param name="retentionAction">Retention action.</param>
 /// <param name="isVisible">Is visible.</param>
 /// <param name="optedInto">Opted into.</param>
 /// <param name="isArchive">Is archive tag.</param>
 internal RetentionPolicyTag(
     string displayName,
     Guid retentionId,
     int retentionPeriod,
     ElcFolderType type,
     RetentionActionType retentionAction,
     bool isVisible,
     bool optedInto,
     bool isArchive)
 {
     DisplayName     = displayName;
     RetentionId     = retentionId;
     RetentionPeriod = retentionPeriod;
     Type            = type;
     RetentionAction = retentionAction;
     IsVisible       = isVisible;
     OptedInto       = optedInto;
     IsArchive       = isArchive;
 }
 /// <summary>
 /// Constructor for retention policy tag.
 /// </summary>
 /// <param name="displayName">Display name.</param>
 /// <param name="retentionId">Retention id.</param>
 /// <param name="retentionPeriod">Retention period.</param>
 /// <param name="type">Retention folder type.</param>
 /// <param name="retentionAction">Retention action.</param>
 /// <param name="isVisible">Is visible.</param>
 /// <param name="optedInto">Opted into.</param>
 /// <param name="isArchive">Is archive tag.</param>
 internal RetentionPolicyTag(
     string displayName,
     Guid retentionId,
     int retentionPeriod,
     ElcFolderType type,
     RetentionActionType retentionAction,
     bool isVisible,
     bool optedInto,
     bool isArchive)
 {
     DisplayName = displayName;
     RetentionId = retentionId;
     RetentionPeriod = retentionPeriod;
     Type = type;
     RetentionAction = retentionAction;
     IsVisible = isVisible;
     OptedInto = optedInto;
     IsArchive = isArchive;
 }
예제 #7
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;
                    }
                }
            }
        }
예제 #8
0
        // Token: 0x06000449 RID: 1097 RVA: 0x0001E7B8 File Offset: 0x0001C9B8
        private Guid GetAdTagGuidForSystemFolder(DefaultFolderType?systemFolderType)
        {
            ElcFolderType elcFolderType = ElcFolderType.All;

            for (int i = 0; i < ElcMailboxHelper.DefaultFolderTypeList.Length; i++)
            {
                if (ElcMailboxHelper.DefaultFolderTypeList[i] == systemFolderType)
                {
                    elcFolderType = ElcMailboxHelper.ElcFolderTypeList[i];
                }
            }
            foreach (AdTagData adTagData in base.ElcUserTagInformation.GetPolicyTagsList())
            {
                if (adTagData.Tag.Type == elcFolderType)
                {
                    return(adTagData.Tag.RetentionId);
                }
            }
            return(Guid.Empty);
        }
        private static Folder GetRootFolder(MailboxSession mailboxSession, ElcFolderType folderType)
        {
            Folder result = null;

            if (folderType == ElcFolderType.Inbox)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Inbox, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Calendar)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Calendar, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.SentItems)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.SentItems, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.DeletedItems)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.DeletedItems, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Contacts)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Contacts, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Calendar)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Calendar, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Drafts)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Drafts, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Outbox)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Outbox, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.JunkEmail)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.JunkEmail, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Tasks)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Tasks, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Journal)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Journal, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.Notes)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Notes, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.All)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Root, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.SyncIssues)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.SyncIssues, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.RssSubscriptions)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.RssSubscription, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.ConversationHistory)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.CommunicatorHistory, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.LegacyArchiveJournals)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.LegacyArchiveJournals, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.NonIpmRoot)
            {
                result = Folder.Bind(mailboxSession, DefaultFolderType.Configuration, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.RecoverableItems)
            {
                if (mailboxSession.GetDefaultFolderId(DefaultFolderType.RecoverableItemsRoot) == null)
                {
                    return(null);
                }
                result = Folder.Bind(mailboxSession, DefaultFolderType.RecoverableItemsRoot, GetMailboxFolderStatistics.folderStatProps);
            }
            else if (folderType == ElcFolderType.ManagedCustomFolder)
            {
                StoreObjectId storeObjectId = null;
                string        text          = null;
                string        text2         = null;
                ProvisionedFolderReader.GetElcRootFolderInfo(mailboxSession, out storeObjectId, out text, out text2);
                if (storeObjectId == null)
                {
                    return(null);
                }
                result = Folder.Bind(mailboxSession, storeObjectId, GetMailboxFolderStatistics.folderStatProps);
            }
            return(result);
        }
        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);
        }
예제 #11
0
 internal static bool FolderTypeAllowsComments(ElcFolderType folderType)
 {
     return(folderType != ElcFolderType.Calendar && folderType != ElcFolderType.Contacts && folderType != ElcFolderType.Notes && folderType != ElcFolderType.Journal && folderType != ElcFolderType.Tasks);
 }