protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); if ("crossforest" == base.ParameterSetName) { try { NetworkCredential userForestCredential = (this.LinkedCredential == null) ? null : this.LinkedCredential.GetNetworkCredential(); this.linkedGroupSid = MailboxTaskHelper.GetSidFromAnotherForest <ADGroup>(this.LinkedForeignGroup, this.LinkedDomainController, userForestCredential, base.GlobalConfigSession, new MailboxTaskHelper.GetUniqueObject(base.GetDataObject <ADGroup>), new Task.ErrorLoggerDelegate(base.ThrowTerminatingError), new MailboxTaskHelper.OneStringErrorDelegate(Strings.ErrorLinkedGroupInTheCurrentForest), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotFoundOnGlobalCatalog), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotFoundOnDomainController), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotUniqueOnGlobalCatalog), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotUniqueOnDomainController), new MailboxTaskHelper.OneStringErrorDelegate(Strings.ErrorVerifyLinkedGroupForest)); } catch (PSArgumentException exception) { base.ThrowTerminatingError(exception, ErrorCategory.InvalidArgument, this.LinkedCredential); } } TaskLogger.LogExit(); }
protected override void InternalBeginProcessing() { bool flag = false; TaskLogger.LogEnter(); base.InternalBeginProcessing(); if (this.ValidationOrganization != null && !string.Equals(this.ValidationOrganization, base.CurrentOrganizationId.ToString(), StringComparison.OrdinalIgnoreCase)) { base.ThrowTerminatingError(new ValidationOrgCurrentOrgNotMatchException(this.ValidationOrganization, base.CurrentOrganizationId.ToString()), ExchangeErrorCategory.Client, null); } if ("crossforest" == base.ParameterSetName) { try { NetworkCredential userForestCredential = (this.LinkedCredential == null) ? null : this.LinkedCredential.GetNetworkCredential(); this.linkedGroupSid = MailboxTaskHelper.GetSidFromAnotherForest <ADGroup>(this.LinkedForeignGroup, this.LinkedDomainController, userForestCredential, base.GlobalConfigSession, new MailboxTaskHelper.GetUniqueObject(base.GetDataObject <ADGroup>), new Task.ErrorLoggerDelegate(base.ThrowTerminatingError), new MailboxTaskHelper.OneStringErrorDelegate(Strings.ErrorLinkedGroupInTheCurrentForest), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotFoundOnGlobalCatalog), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotFoundOnDomainController), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotUniqueOnGlobalCatalog), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotUniqueOnDomainController), new MailboxTaskHelper.OneStringErrorDelegate(Strings.ErrorVerifyLinkedGroupForest)); } catch (PSArgumentException exception) { base.ThrowTerminatingError(exception, ErrorCategory.InvalidArgument, this.LinkedCredential); } } if (!base.Fields.IsModified(ADGroupSchema.ManagedBy) && base.CurrentOrganizationId.Equals(base.ExecutingUserOrganizationId)) { List <SecurityPrincipalIdParameter> list = new List <SecurityPrincipalIdParameter>(2); flag = true; bool useGlobalCatalog = base.TenantGlobalCatalogSession.UseGlobalCatalog; bool useConfigNC = base.TenantGlobalCatalogSession.UseConfigNC; bool skipRangedAttributes = base.TenantGlobalCatalogSession.SkipRangedAttributes; try { base.TenantGlobalCatalogSession.UseGlobalCatalog = true; base.TenantGlobalCatalogSession.UseConfigNC = false; base.TenantGlobalCatalogSession.SkipRangedAttributes = true; ADGroup adgroup = base.TenantGlobalCatalogSession.ResolveWellKnownGuid <ADGroup>(RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid, OrganizationId.ForestWideOrgId.Equals(base.CurrentOrganizationId) ? this.ConfigurationSession.ConfigurationNamingContext : base.TenantGlobalCatalogSession.SessionSettings.CurrentOrganizationId.ConfigurationUnit); if (adgroup == null) { base.ThrowTerminatingError(new ManagementObjectNotFoundException(DirectoryStrings.ExceptionADTopologyCannotFindWellKnownExchangeGroup), (ErrorCategory)1001, RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid); } list.Add(new SecurityPrincipalIdParameter(adgroup.DistinguishedName)); } finally { base.TenantGlobalCatalogSession.UseGlobalCatalog = useGlobalCatalog; base.TenantGlobalCatalogSession.UseConfigNC = useConfigNC; base.TenantGlobalCatalogSession.SkipRangedAttributes = skipRangedAttributes; } ADObjectId adObjectId; if (base.TryGetExecutingUserId(out adObjectId)) { list.Add(new SecurityPrincipalIdParameter(adObjectId)); } this.ManagedBy = new MultiValuedProperty <SecurityPrincipalIdParameter>(list); } if (this.ManagedBy == null) { base.WriteError(new RecipientTaskException(Strings.ErrorManagedByCannotBeEmpty), (ErrorCategory)1000, null); } if (!flag || !DatacenterRegistry.IsForefrontForOffice()) { MailboxTaskHelper.CheckAndResolveManagedBy <ADGroup>(this, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), ExchangeErrorCategory.Client, this.ManagedBy.ToArray(), out this.managedByRecipients); } TaskLogger.LogExit(); }