예제 #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;
        }
예제 #2
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            if (dataObject == null)
            {
                return(null);
            }
            if (((ADUser)dataObject).ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2010))
            {
                base.WriteError(new InvalidOperationException(Strings.NotSupportedForPre14Mailbox(ExchangeObjectVersion.Exchange2010.ToString(), this.Identity.ToString(), ((ADUser)dataObject).ExchangeVersion.ToString())), ErrorCategory.InvalidOperation, this.Identity);
            }
            IConfigurable result;

            using (MailboxSession mailboxSession = ELCTaskHelper.OpenMailboxSession((ADUser)dataObject, "Client=Management;Action=Get-MailboxComplianceConfiguration", new Task.TaskErrorLoggingDelegate(base.WriteError)))
            {
                if (mailboxSession == null)
                {
                    base.WriteError(new TaskException(Strings.ErrorNonExchangeUserError(this.Identity.ToString())), ErrorCategory.NotSpecified, null);
                }
                result = new MailboxComplianceConfiguration(mailboxSession)
                {
                    Identity       = dataObject.Identity,
                    OrganizationId = ((ADUser)dataObject).OrganizationId
                };
            }
            return(result);
        }
예제 #3
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ELCTaskHelper.VerifyIsInConfigScopes(this.DataObject, base.SessionSettings, new Task.TaskErrorLoggingDelegate(base.WriteError));
            string fqdn = this.DataObject.Fqdn;
            AssistantsRpcClient assistantsRpcClient = new AssistantsRpcClient(fqdn);
            int num = 3;

            try
            {
IL_37:
                assistantsRpcClient.Stop("ElcAssistant");
            }
            catch (RpcException ex)
            {
                num--;
                if ((ex.ErrorCode == 1753 || ex.ErrorCode == 1727) && num > 0)
                {
                    goto IL_37;
                }
                base.WriteError(new TaskException(RpcUtility.MapRpcErrorCodeToMessage(ex.ErrorCode, fqdn)), ErrorCategory.InvalidOperation, null);
                goto IL_37;
            }
            TaskLogger.LogExit();
        }
예제 #4
0
        internal static List <RetentionPolicyTag> FindRetentionPolicyTag(IConfigurationSession session, Guid tagGuid)
        {
            OrFilter filter = new OrFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, RetentionPolicyTagSchema.RetentionId, tagGuid),
                new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, tagGuid)
            });

            return(ELCTaskHelper.FindElcObject <RetentionPolicyTag>(session, null, filter));
        }
예제 #5
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     ELCTaskHelper.VerifyIsInScopes(this.DataObject, base.ScopeSet, new Task.TaskErrorLoggingDelegate(base.WriteError));
     if (this.DataObject.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2010))
     {
         base.WriteError(new InvalidOperationException(Strings.NotSupportedForPre14Mailbox(ExchangeObjectVersion.Exchange2010.ToString(), this.Identity.ToString(), this.DataObject.ExchangeVersion.ToString())), ErrorCategory.InvalidOperation, this.Identity);
     }
     TaskLogger.LogExit();
 }
예제 #6
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            string mailboxAddress = this.Identity.ToString();
            ADUser dataObject     = this.DataObject;

            ELCTaskHelper.VerifyIsInScopes(dataObject, base.ScopeSet, new Task.TaskErrorLoggingDelegate(base.WriteError));
            if (dataObject.ExchangeGuid != Guid.Empty && dataObject.RecipientType != RecipientType.MailUser && dataObject.Database != null)
            {
                MailboxDatabase mailboxDatabase = base.GlobalConfigSession.Read <MailboxDatabase>(dataObject.Database);
                if (mailboxDatabase == null)
                {
                    base.WriteError(new ArgumentException(Strings.ElcMdbNotFound(mailboxAddress), "Mailbox"), ErrorCategory.InvalidArgument, null);
                }
                this.InternalProcessOneMailbox(dataObject.ExchangeGuid, mailboxDatabase.Guid);
            }
            if (dataObject.ArchiveState == ArchiveState.Local)
            {
                ADObjectId      entryId          = dataObject.ArchiveDatabase ?? dataObject.Database;
                MailboxDatabase mailboxDatabase2 = base.GlobalConfigSession.Read <MailboxDatabase>(entryId);
                if (mailboxDatabase2 == null)
                {
                    base.WriteError(new ArgumentException(Strings.ElcMdbNotFound(mailboxAddress), "Archive Mailbox"), ErrorCategory.InvalidArgument, null);
                }
                if (StoreRetentionPolicyTagHelper.HasOnPremArchiveMailbox(dataObject))
                {
                    try
                    {
                        StoreRetentionPolicyTagHelper.SyncOptionalTagsFromPrimaryToArchive(dataObject);
                    }
                    catch (ElcUserConfigurationException)
                    {
                        this.WriteWarning(Strings.WarningArchiveMailboxNotReachable(mailboxAddress));
                    }
                }
                this.InternalProcessOneMailbox(dataObject.ArchiveGuid, mailboxDatabase2.Guid);
            }
            if (!this.processed)
            {
                this.WriteWarning(Strings.ElcNoLocalMbxOrArchive(mailboxAddress));
            }
            TaskLogger.LogExit();
        }
예제 #7
0
        internal static List <ELCFolder> FindELCFolder(IConfigurationSession session, ADObjectId rootId, object valueToSearch, FindByType findByType)
        {
            QueryFilter filter;

            switch (findByType)
            {
            case FindByType.Name:
                filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, (string)valueToSearch);
                goto IL_D4;

            case FindByType.FolderName:
                filter = new OrFilter(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.Equal, ELCFolderSchema.FolderName, (string)valueToSearch),
                    new TextFilter(ELCFolderSchema.LocalizedFolderName, (string)valueToSearch, MatchOptions.SubString, MatchFlags.IgnoreCase)
                });
                goto IL_D4;

            case FindByType.FolderType:
                filter = new ComparisonFilter(ComparisonOperator.Equal, ELCFolderSchema.FolderType, (ElcFolderType)valueToSearch);
                goto IL_D4;

            case FindByType.FolderAdObjectId:
                filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, valueToSearch as ADObjectId);
                goto IL_D4;

            case FindByType.FolderDefaultType:
                filter = new ComparisonFilter(ComparisonOperator.NotEqual, ELCFolderSchema.FolderType, ElcFolderType.ManagedCustomFolder);
                goto IL_D4;

            case FindByType.FolderOrganizationalType:
                filter = new ComparisonFilter(ComparisonOperator.Equal, ELCFolderSchema.FolderType, ElcFolderType.ManagedCustomFolder);
                goto IL_D4;
            }
            filter = null;
IL_D4:
            return(ELCTaskHelper.FindElcObject <ELCFolder>(session, rootId, filter));
        }
예제 #8
0
 internal static List <ELCFolder> FindELCFolder(IConfigurationSession session, object valueToSearch, FindByType findByType)
 {
     return(ELCTaskHelper.FindELCFolder(session, null, valueToSearch, findByType));
 }
예제 #9
0
        internal static List <ElcContentSettings> FindELCContentSettings(IConfigurationSession session, string name)
        {
            QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, name);

            return(ELCTaskHelper.FindElcObject <ElcContentSettings>(session, null, filter));
        }