Beispiel #1
0
        private void Process(bool archiveMailbox, out ExchangePrincipal exchPrincipal)
        {
            ExchangePrincipal exchangePrincipal = null;

            try
            {
                using (StoreRetentionPolicyTagHelper storeRetentionPolicyTagHelper = StoreRetentionPolicyTagHelper.FromMailboxId(base.DomainController, this.Mailbox, archiveMailbox, base.CurrentOrganizationId))
                {
                    exchangePrincipal = storeRetentionPolicyTagHelper.UserPrincipal;
                    ELCTaskHelper.VerifyIsInScopes(storeRetentionPolicyTagHelper.Mailbox, base.ScopeSet, new Task.TaskErrorLoggingDelegate(base.WriteError));
                    if (storeRetentionPolicyTagHelper.Mailbox.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2010))
                    {
                        base.WriteError(new InvalidOperationException(Strings.OptInNotSupportedForPre14Mailbox(ExchangeObjectVersion.Exchange2010.ToString(), storeRetentionPolicyTagHelper.Mailbox.Identity.ToString(), storeRetentionPolicyTagHelper.Mailbox.ExchangeVersion.ToString())), ErrorCategory.InvalidOperation, storeRetentionPolicyTagHelper.Mailbox.Identity);
                    }
                    if (storeRetentionPolicyTagHelper.Mailbox.RetentionPolicy == null && !storeRetentionPolicyTagHelper.Mailbox.ShouldUseDefaultRetentionPolicy)
                    {
                        base.WriteError(new ArgumentException(Strings.RetentionPolicyNotEnabled, "Mailbox"), ErrorCategory.InvalidArgument, null);
                    }
                    IConfigurationSession configurationSession = base.DataSession as IConfigurationSession;
                    configurationSession.SessionSettings.IsSharedConfigChecked = true;
                    List <StoreTagData> optionalStoreTags = SetRetentionPolicyTag.ResolveTags(configurationSession, this.OptionalInMailbox);
                    this.ProcessOptionalTags(storeRetentionPolicyTagHelper.TagData, optionalStoreTags, archiveMailbox);
                    storeRetentionPolicyTagHelper.Save();
                }
            }
            catch (ElcUserConfigurationException exception)
            {
                base.WriteError(exception, ErrorCategory.ResourceUnavailable, null);
            }
            exchPrincipal = exchangePrincipal;
        }
Beispiel #2
0
        internal static List <StoreTagData> ResolveTags(IConfigurationSession session, RetentionPolicyTagIdParameter[] tags)
        {
            List <StoreTagData> list = new List <StoreTagData>((tags != null) ? tags.Length : 1);

            if (tags != null)
            {
                foreach (RetentionPolicyTagIdParameter tagId in tags)
                {
                    StoreTagData storeTagData = SetRetentionPolicyTag.ResolveTag(session, tagId);
                    if (storeTagData != null)
                    {
                        list.Add(storeTagData);
                    }
                }
            }
            return(list);
        }