internal MsoServerHistoryManager(string serviceInstanceName, int maxServerHistoryEntries, bool createRootContainer)
        {
            this.serverHistorySession             = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 63, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\Sync\\MsoServerHistoryManager.cs");
            this.serverHistorySession.UseConfigNC = false;
            this.MaxServerHistoryEntries          = maxServerHistoryEntries;
            this.ServiceInstanceName = serviceInstanceName;
            ADObjectId serviceInstanceObjectId = SyncServiceInstance.GetServiceInstanceObjectId(this.ServiceInstanceName);
            Container  container = this.serverHistorySession.Read <Container>(serviceInstanceObjectId.GetChildId("ServerHistory"));

            if (container == null && createRootContainer)
            {
                container = new Container();
                container.SetId(serviceInstanceObjectId.GetChildId("ServerHistory"));
                try
                {
                    this.serverHistorySession.Save(container);
                }
                catch (ADObjectAlreadyExistsException)
                {
                }
            }
            if (container != null)
            {
                ServerHistoryEntry[] array = this.serverHistorySession.Find <ServerHistoryEntry>(container.Id, QueryScope.OneLevel, null, null, 0);
                Array.Sort <ServerHistoryEntry>(array, (ServerHistoryEntry x, ServerHistoryEntry y) => DateTime.Compare(DateTime.Parse(x.Name.Substring(0, x.Name.IndexOf("-"))), DateTime.Parse(y.Name.Substring(0, y.Name.IndexOf("-")))));
                this.serverHistoryEntriesList     = array.ToList <ServerHistoryEntry>();
                this.serverHistoryRootContainerID = container.Id;
            }
        }
예제 #2
0
        private static SystemMessage[] GetAllResourceSystemMessages(ADObjectId orgContainer)
        {
            CultureInfo[]     allSupportedDsnLanguages = ClientCultures.GetAllSupportedDsnLanguages();
            string[]          array;
            LocalizedString[] array2;
            DsnDefaultMessages.GetAllDsnCodesAndMessages(out array, out array2);
            QuotaMessageType[] array3 = (QuotaMessageType[])Enum.GetValues(typeof(QuotaMessageType));
            SystemMessage[]    array4 = new SystemMessage[(array.Length + array3.Length) * allSupportedDsnLanguages.Length];
            int num = 0;

            foreach (CultureInfo cultureInfo in allSupportedDsnLanguages)
            {
                ADObjectId dsnCustomizationContainer = SystemMessage.GetDsnCustomizationContainer(orgContainer);
                ADObjectId childId  = dsnCustomizationContainer.GetChildId(cultureInfo.LCID.ToString(NumberFormatInfo.InvariantInfo));
                ADObjectId childId2 = childId.GetChildId("internal");
                for (int j = 0; j < array.Length; j++)
                {
                    array4[num] = new SystemMessage();
                    array4[num].SetId(childId2.GetChildId(array[j]));
                    array4[num].Text = array2[j].ToString(cultureInfo);
                    num++;
                }
                foreach (QuotaMessageType quotaMessageType in array3)
                {
                    QuotaLocalizedTexts quotaLocalizedTexts = QuotaLocalizedTexts.GetQuotaLocalizedTexts(SetSystemMessage.ConvertToInternal(quotaMessageType), string.Empty, string.Empty, true);
                    array4[num] = new SystemMessage();
                    array4[num].SetId(childId.GetChildId(quotaMessageType.ToString()));
                    array4[num].Text = quotaLocalizedTexts.Details.ToString(cultureInfo);
                    num++;
                }
            }
            return(array4);
        }
예제 #3
0
        protected void RemoveSystemMailbox()
        {
            TDataObject dataObject = base.DataObject;
            ADObjectId  adobjectId = ((ADObjectId)dataObject.Identity).DomainId;

            adobjectId = adobjectId.GetChildId("Microsoft Exchange System Objects");
            adobjectId = adobjectId.GetChildId("SystemMailbox" + dataObject.Guid.ToString("B"));
            try
            {
                string identity = adobjectId.ToDNString();
                GeneralMailboxIdParameter generalMailboxIdParameter = GeneralMailboxIdParameter.Parse(identity);
                base.WriteVerbose(TaskVerboseStringHelper.GetFindByIdParameterVerboseString(generalMailboxIdParameter, this.RecipientSessionForSystemMailbox, typeof(ADRecipient), null));
                IEnumerable <ADSystemMailbox> objects = generalMailboxIdParameter.GetObjects <ADSystemMailbox>(null, this.RecipientSessionForSystemMailbox);
                using (IEnumerator <ADSystemMailbox> enumerator = objects.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        ADSystemMailbox adsystemMailbox = enumerator.Current;
                        base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(this.RecipientSessionForSystemMailbox));
                        base.WriteVerbose(Strings.VerboseDeleteSystemAttendantObject(adsystemMailbox.Identity.ToString()));
                        this.RecipientSessionForSystemMailbox.Delete(adsystemMailbox);
                    }
                }
            }
            catch (DataSourceTransientException ex)
            {
                TaskLogger.Trace("The action of Removing system mailbox object of database '{0}' raises exception: {1}.", new object[]
                {
                    dataObject.Identity.ToString(),
                    ex.Message
                });
                this.WriteWarning(Strings.ErrorFailedToRemoveSystemMailbox(dataObject.Identity.ToString(), ex.Message));
            }
            catch (DataSourceOperationException ex2)
            {
                TaskLogger.Trace("The action of Removing system mailbox object of database '{0}' raises exception: {1}.", new object[]
                {
                    dataObject.Identity.ToString(),
                    ex2.Message
                });
                this.WriteWarning(Strings.ErrorFailedToRemoveSystemMailbox(dataObject.Identity.ToString(), ex2.Message));
            }
            catch (DataValidationException ex3)
            {
                TaskLogger.Trace("The action of Removing system mailbox object of database '{0}' raises exception: {1}.", new object[]
                {
                    dataObject.Identity.ToString(),
                    ex3.Message
                });
                this.WriteWarning(Strings.ErrorFailedToRemoveSystemMailbox(dataObject.Identity.ToString(), ex3.Message));
            }
            finally
            {
                base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(this.RecipientSessionForSystemMailbox));
            }
            TaskLogger.Trace("The action of Removing system mailbox object of database '{0}' succeeded.", new object[]
            {
                dataObject.Identity.ToString()
            });
        }
예제 #4
0
            private static IEnumerable <PolicyTipMessageConfig> GetBuiltIn()
            {
                ADObjectId GlobalScopeContainerId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().GetDescendantId(PolicyTipMessageConfig.PolicyTipMessageConfigContainer);
                IEnumerable <CultureInfo> supportedCultureInfos = from lcid in LanguagePackInfo.expectedCultureLcids
                                                                  select new CultureInfo(lcid);
                PolicyTipMessageConfig policyTipMessageConfig;

                foreach (CultureInfo exchangeCultureInfo in supportedCultureInfos)
                {
                    foreach (Tuple <PolicyTipMessageConfigAction, LocalizedString> mapping in PerTenantPolicyNudgeRulesCollection.PolicyTipMessages.builtInActionStringsMapping)
                    {
                        policyTipMessageConfig = new PolicyTipMessageConfig
                        {
                            Action = mapping.Item1,
                            Locale = exchangeCultureInfo.Name,
                            Value  = mapping.Item2.ToString(exchangeCultureInfo)
                        };
                        policyTipMessageConfig.SetId(GlobalScopeContainerId.GetChildId("BuiltIn\\" + exchangeCultureInfo.Name + "\\" + mapping.Item1.ToString()));
                        yield return(policyTipMessageConfig);
                    }
                }
                policyTipMessageConfig = new PolicyTipMessageConfig
                {
                    Action = PolicyTipMessageConfigAction.Url,
                    Locale = string.Empty,
                    Value  = string.Empty
                };
                policyTipMessageConfig.SetId(GlobalScopeContainerId.GetChildId("BuiltIn\\" + PolicyTipMessageConfigAction.Url.ToString()));
                yield return(policyTipMessageConfig);

                yield break;
            }
        protected override IConfigurable PrepareDataObject()
        {
            ADComplianceProgramCollection adcomplianceProgramCollection = (ADComplianceProgramCollection)base.PrepareDataObject();
            ADObjectId adobjectId = base.CurrentOrgContainerId;

            adobjectId = adobjectId.GetChildId("Transport Settings");
            adobjectId = adobjectId.GetChildId("Rules");
            adobjectId = adobjectId.GetChildId(base.Name);
            adcomplianceProgramCollection.SetId(adobjectId);
            return(adcomplianceProgramCollection);
        }
        protected override IConfigurable PrepareDataObject()
        {
            ADComplianceProgramCollection adcomplianceProgramCollection = (ADComplianceProgramCollection)base.PrepareDataObject();

            adcomplianceProgramCollection.Name = DlpUtils.OutOfBoxDlpPoliciesCollectionName;
            ADObjectId adobjectId = base.RootOrgContainerId;

            adobjectId = adobjectId.GetChildId("Transport Settings");
            adobjectId = adobjectId.GetChildId("Rules");
            adobjectId = adobjectId.GetChildId(adcomplianceProgramCollection.Name);
            adcomplianceProgramCollection.SetId(adobjectId);
            return(adcomplianceProgramCollection);
        }
예제 #7
0
        protected override IConfigurable PrepareDataObject()
        {
            base.PrepareDataObject();
            ITopologyConfigurationSession topologyConfigurationSession = (ITopologyConfigurationSession)base.DataSession;

            this.DataObject.Edition             = ServerEditionType.StandardEvaluation;
            this.DataObject.AdminDisplayVersion = ConfigurationContext.Setup.InstalledVersion;
            this.DataObject.VersionNumber       = SystemConfigurationTasksHelper.GenerateVersionNumber(ConfigurationContext.Setup.InstalledVersion);
            this.DataObject.MailboxRelease      = MailboxRelease.E15;
            if (string.IsNullOrEmpty(this.Name))
            {
                string localComputerFqdn = NativeHelpers.GetLocalComputerFqdn(true);
                int    num = localComputerFqdn.IndexOf('.');
                this.DataObject.Name = ((num == -1) ? localComputerFqdn : localComputerFqdn.Substring(0, num));
                NewExchangeServer.TcpNetworkAddress value = new NewExchangeServer.TcpNetworkAddress(NetworkProtocol.TcpIP, localComputerFqdn);
                this.DataObject.NetworkAddress = new NetworkAddressCollection(value);
            }
            this.DataObject.FaultZone = "FaultZone1";
            ADObjectId childId  = topologyConfigurationSession.GetAdministrativeGroupId().GetChildId("Servers");
            ADObjectId childId2 = childId.GetChildId(this.DataObject.Name);

            this.DataObject.SetId(childId2);
            this.DataObject.ExchangeLegacyDN = LegacyDN.GenerateLegacyDN(Server.GetParentLegacyDN(topologyConfigurationSession), this.DataObject);
            using (RegistryKey registryKey = RegistryUtil.OpenRemoteBaseKey(RegistryHive.LocalMachine, NativeHelpers.GetLocalComputerFqdn(true)))
            {
                using (RegistryKey registryKey2 = registryKey.OpenSubKey(NewExchangeServer.EdgeKeyName))
                {
                    if (registryKey2 == null && this.IsDomainJoined())
                    {
                        this.SetServerSiteInformation(topologyConfigurationSession);
                    }
                }
            }
            return(this.DataObject);
        }
예제 #8
0
        private void FixGroupProperties(ADGroup group)
        {
            if (group == null)
            {
                return;
            }
            RoleGroup.RoleGroupTypeIds roleGroupTypeIds;
            if (group.RawCapabilities.Contains(Capability.Partner_Managed))
            {
                if (FfoRecipientSession.partnerManagedRoleGroups.TryGetValue(group.Name, out roleGroupTypeIds))
                {
                    group[ADGroupSchema.RoleGroupTypeId] = (int)roleGroupTypeIds;
                }
            }
            else if (Enum.TryParse <RoleGroup.RoleGroupTypeIds>(group.Name, out roleGroupTypeIds))
            {
                group[ADGroupSchema.RoleGroupTypeId] = (int)roleGroupTypeIds;
            }
            ADObjectId organizationalUnitRoot = group.OrganizationalUnitRoot;
            MultiValuedProperty <ADObjectId> multiValuedProperty = group[ADGroupSchema.RoleAssignments] as MultiValuedProperty <ADObjectId>;

            if (multiValuedProperty != null && organizationalUnitRoot != null)
            {
                for (int i = 0; i < multiValuedProperty.Count; i++)
                {
                    ADObjectId adobjectId = multiValuedProperty[i];
                    adobjectId             = new ADObjectId(organizationalUnitRoot.GetChildId(adobjectId.Name).DistinguishedName, adobjectId.ObjectGuid);
                    multiValuedProperty[i] = adobjectId;
                }
            }
        }
예제 #9
0
        protected override IConfigurable PrepareDataObject()
        {
            ADObjectId  orgContainerId = ((IConfigurationSession)base.DataSession).GetOrgContainerId();
            QueryFilter filter         = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, AdministrativeGroup.DefaultName);

            AdministrativeGroup[] array = ((IConfigurationSession)base.DataSession).Find <AdministrativeGroup>(null, QueryScope.SubTree, filter, null, 1);
            AdministrativeGroup   administrativeGroup;

            if (array != null && array.Length > 0)
            {
                administrativeGroup = array[0];
                if (string.IsNullOrEmpty(administrativeGroup.LegacyExchangeDN))
                {
                    administrativeGroup.StampLegacyExchangeDN(((IConfigurationSession)base.DataSession).GetOrgContainer().LegacyExchangeDN, administrativeGroup.Name);
                }
            }
            else
            {
                administrativeGroup = (AdministrativeGroup)base.PrepareDataObject();
                administrativeGroup.SetId(orgContainerId.GetChildId("Administrative Groups").GetChildId(AdministrativeGroup.DefaultName));
                administrativeGroup.StampLegacyExchangeDN(((IConfigurationSession)base.DataSession).GetOrgContainer().LegacyExchangeDN, AdministrativeGroup.DefaultName);
                filter = new ComparisonFilter(ComparisonOperator.Equal, AdministrativeGroupSchema.DefaultAdminGroup, true);
                AdministrativeGroup[] array2 = ((IConfigurationSession)base.DataSession).Find <AdministrativeGroup>(null, QueryScope.SubTree, filter, null, 0);
                administrativeGroup.DefaultAdminGroup = (array2 == null || array2.Length == 0);
            }
            return(administrativeGroup);
        }
예제 #10
0
        protected override IConfigurable PrepareDataObject()
        {
            this.CreateAuthServersContainer();
            AuthServer authServer  = (AuthServer)base.PrepareDataObject();
            ADObjectId containerId = AuthServer.GetContainerId(this.ConfigurationSession);

            authServer.SetId(containerId.GetChildId(authServer.Name));
            if (base.Fields.IsModified("AppSecretParameter"))
            {
                if (authServer.Type != AuthServerType.Facebook && authServer.Type != AuthServerType.LinkedIn)
                {
                    base.WriteError(new TaskException(Strings.ErrorInvalidAuthServerTypeValue), ErrorCategory.InvalidArgument, null);
                }
                authServer.CurrentEncryptedAppSecret = OAuthTaskHelper.EncryptSecretWithDKM(this.AppSecret, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            else if (authServer.IsModified(AuthServerSchema.AuthMetadataUrl))
            {
                if (!authServer.IsModified(AuthServerSchema.Type))
                {
                    authServer.Type = AuthServerType.MicrosoftACS;
                }
                else if (authServer.Type != AuthServerType.ADFS && authServer.Type != AuthServerType.AzureAD)
                {
                    base.WriteError(new TaskException(Strings.ErrorInvalidAuthServerTypeValue), ErrorCategory.InvalidArgument, null);
                }
                OAuthTaskHelper.FixAuthMetadataUrl(authServer, new Task.TaskErrorLoggingDelegate(base.WriteError));
                OAuthTaskHelper.FetchAuthMetadata(authServer, this.TrustAnySSLCertificate, true, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            OAuthTaskHelper.ValidateAuthServerRealmAndUniqueness(authServer, this.ConfigurationSession, new Task.TaskErrorLoggingDelegate(base.WriteError));
            return(this.DataObject);
        }
예제 #11
0
        internal static void UpdateRecipientForSoftDelete(IRecipientSession session, ADUser recipient, bool includeInGarbageCollection, bool isInactive)
        {
            int num = 1;

            if (includeInGarbageCollection)
            {
                num |= 4;
            }
            if (isInactive)
            {
                num |= 8;
            }
            recipient.propertyBag.SetField(ADRecipientSchema.RecipientSoftDeletedStatus, num);
            recipient.propertyBag.SetField(ADRecipientSchema.WhenSoftDeleted, new DateTime?(DateTime.UtcNow));
            int num2 = (int)recipient.propertyBag[ADRecipientSchema.TransportSettingFlags];

            num2 |= 8;
            recipient.propertyBag.SetField(ADRecipientSchema.TransportSettingFlags, num2);
            if (!"Soft Deleted Objects".Equals(recipient.Id.Parent.Name))
            {
                ADObjectId childId = recipient.Id.Parent.GetChildId("OU", "Soft Deleted Objects");
                childId = childId.GetChildId(SoftDeletedTaskHelper.ReservedADNameStringRegex.Replace(recipient.Id.Name, string.Empty));
                string userPrincipalName = recipient.UserPrincipalName;
                session.SessionSettings.IncludeSoftDeletedObjects = true;
                if (session.Read(childId) != null)
                {
                    childId = childId.Parent.GetChildId(MailboxTaskHelper.AppendRandomNameSuffix(childId.Name));
                }
                session.SessionSettings.IncludeSoftDeletedObjects = false;
                recipient.SetId(childId);
                recipient.UserPrincipalName = userPrincipalName;
            }
        }
예제 #12
0
        internal static ADObjectId GetRelativeDnForEntryType(Utils.EntryType entryType, IConfigurationSession session)
        {
            string     unescapedCommonName = (entryType == Utils.EntryType.SmtpAddress) ? Utils.EmailEntriesRDn : Utils.DomainEntriesRDn;
            ADObjectId childId             = Utils.RootId.GetChildId(Utils.AddressRewriteConfigRDn);

            return(childId.GetChildId(unescapedCommonName));
        }
예제 #13
0
        public static ADObjectId GetRuleCollectionId(IConfigDataProvider session, string ruleCollection)
        {
            IConfigurationSession configurationSession = (IConfigurationSession)session;
            ADObjectId            orgContainerId       = configurationSession.GetOrgContainerId();

            return(orgContainerId.GetChildId("Transport Settings").GetChildId("Rules").GetChildId(ruleCollection));
        }
예제 #14
0
        protected override IConfigurable PrepareDataObject()
        {
            QueryFilter           filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, "Internet Message Formats");
            IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession;

            configurationSession.SessionSettings.IsSharedConfigChecked = true;
            ADObjectId childId = configurationSession.GetOrgContainerId().GetChildId("Global Settings");

            ContentConfigContainer[] array = configurationSession.Find <ContentConfigContainer>(childId, QueryScope.OneLevel, filter, null, 0);
            ContentConfigContainer   contentConfigContainer;

            if (this.isContainerExisted = (array != null && array.Length > 0))
            {
                contentConfigContainer = array[0];
            }
            else
            {
                contentConfigContainer = (ContentConfigContainer)base.PrepareDataObject();
                contentConfigContainer.SetId(childId.GetChildId("Internet Message Formats"));
                MultiValuedProperty <string> mimeTypes = contentConfigContainer.MimeTypes;
                foreach (string item in InstallInternetMessageFormat.newTypes)
                {
                    if (!mimeTypes.Contains(item))
                    {
                        mimeTypes.Add(item);
                    }
                }
                contentConfigContainer.MimeTypes = mimeTypes;
            }
            return(contentConfigContainer);
        }
예제 #15
0
 // Token: 0x06001986 RID: 6534 RVA: 0x0006C30D File Offset: 0x0006A50D
 internal ADGroup(IRecipientSession session, string commonName, ADObjectId containerId, GroupTypeFlags groupType)
 {
     this.m_Session = session;
     base.SetId(containerId.GetChildId(commonName));
     base.SetObjectClass(this.MostDerivedObjectClass);
     this.GroupType = groupType;
 }
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            this.tenantCU = this.configurationSession.Read <ExchangeConfigurationUnit>(this.organization.ConfigurationUnit);
            if (this.tenantCU == null)
            {
                base.ThrowTerminatingError(new ArgumentException(Strings.ErrorOrganizationNotFound(this.organization.ConfigurationUnit.ToString())), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.tenantCU);
            ADObjectId childId = this.tenantCU.Id.GetChildId("Address Lists Container");

            this.addressListsContainer = this.configurationSession.Read <Container>(childId);
            if (this.addressListsContainer == null)
            {
                base.ThrowTerminatingError(new DirectoryObjectNotFoundException(childId.DistinguishedName), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.addressListsContainer);
            ADObjectId childId2 = childId.GetChildId("Offline Address Lists");

            this.offlineAddressListsContainer = this.configurationSession.Read <Container>(childId2);
            if (this.offlineAddressListsContainer == null)
            {
                base.ThrowTerminatingError(new DirectoryObjectNotFoundException(childId2.DistinguishedName), ErrorCategory.InvalidData, null);
            }
            base.LogReadObject(this.offlineAddressListsContainer);
            TaskLogger.LogExit();
        }
예제 #17
0
        public static ADObjectId GetUpdatedADObjectIdWithDN(ADObjectId adObject, string tenantDistinguishedName, Guid tenantGuid, ADObjectId relativeConfigDN = null)
        {
            if (adObject == null || string.IsNullOrEmpty(tenantDistinguishedName))
            {
                return(null);
            }
            if (tenantGuid == Guid.Empty || adObject.ObjectGuid == Guid.Empty)
            {
                throw new InvalidOperationException(string.Format("Unable to fix distinguished name for ADObject = {0}, TenantGuid = {1}, ObjectGuid = {2}, objectName = {3}.", new object[]
                {
                    adObject.GetType().Name,
                    tenantGuid,
                    adObject.ObjectGuid,
                    adObject.Name
                }));
            }
            string     unescapedCommonName = string.IsNullOrEmpty(adObject.Name) ? adObject.ObjectGuid.ToString() : adObject.Name;
            ADObjectId adobjectId          = new ADObjectId(tenantDistinguishedName, tenantGuid);
            ADObjectId adobjectId2         = new ADObjectId(adobjectId.GetChildId("Configuration").DistinguishedName, tenantGuid);

            if (relativeConfigDN != null)
            {
                adobjectId2 = new ADObjectId(adobjectId2.GetDescendantId(relativeConfigDN).DistinguishedName, tenantGuid);
            }
            return(new ADObjectId(adobjectId2.GetChildId(unescapedCommonName).DistinguishedName, adObject.ObjectGuid));
        }
예제 #18
0
 protected override void PrepareRecipientObject(ADDynamicGroup group)
 {
     TaskLogger.LogEnter();
     base.PrepareRecipientObject(group);
     if (base.OrganizationalUnit == null && group[ADRecipientSchema.DefaultDistributionListOU] != null)
     {
         ADObjectId adobjectId = (ADObjectId)group[ADRecipientSchema.DefaultDistributionListOU];
         RecipientTaskHelper.ResolveOrganizationalUnitInOrganization(new OrganizationalUnitIdParameter(adobjectId), this.ConfigurationSession, base.CurrentOrganizationId, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ExchangeOrganizationalUnit>), ExchangeErrorCategory.ServerOperation, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
         group.SetId(adobjectId.GetChildId(base.Name));
     }
     if (this.RecipientContainer == null)
     {
         if (!base.Fields.IsModified(ADDynamicGroupSchema.RecipientContainer))
         {
             group.RecipientContainer = group.Id.Parent;
         }
     }
     else
     {
         bool useConfigNC      = this.ConfigurationSession.UseConfigNC;
         bool useGlobalCatalog = this.ConfigurationSession.UseGlobalCatalog;
         this.ConfigurationSession.UseConfigNC = false;
         if (string.IsNullOrEmpty(this.ConfigurationSession.DomainController))
         {
             this.ConfigurationSession.UseGlobalCatalog = true;
         }
         ExchangeOrganizationalUnit exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(this.RecipientContainer, this.ConfigurationSession, (base.CurrentOrganizationId != null) ? base.CurrentOrganizationId.OrganizationalUnit : null, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.RecipientContainer.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.RecipientContainer.ToString())), ExchangeErrorCategory.Client);
         RecipientTaskHelper.IsOrgnizationalUnitInOrganization(this.ConfigurationSession, group.OrganizationId, exchangeOrganizationalUnit, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
         this.ConfigurationSession.UseConfigNC      = useConfigNC;
         this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog;
         group.RecipientContainer = (ADObjectId)exchangeOrganizationalUnit.Identity;
     }
     group.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.DynamicDistributionGroup);
     TaskLogger.LogExit();
 }
        private void ProcessMailboxTransportServerRole(bool isMailboxTransportServer, ITopologyConfigurationSession scSession, ADObjectId configContainerId)
        {
            ADObjectId childId = configContainerId.GetChildId("Mailbox");

            IConfigurable[] array = base.DataSession.Find <MailboxTransportServer>(null, childId, true, null);
            if (isMailboxTransportServer)
            {
                if (array.Length == 0)
                {
                    MailboxTransportServer mailboxTransportServer = new MailboxTransportServer();
                    mailboxTransportServer.NetworkAddress      = this.DataObject.NetworkAddress;
                    mailboxTransportServer.Name                = "Mailbox";
                    mailboxTransportServer.Edition             = ServerEditionType.StandardEvaluation;
                    mailboxTransportServer.AdminDisplayVersion = ConfigurationContext.Setup.InstalledVersion;
                    mailboxTransportServer.VersionNumber       = SystemConfigurationTasksHelper.GenerateVersionNumber(ConfigurationContext.Setup.InstalledVersion);
                    mailboxTransportServer.ExchangeLegacyDN    = LegacyDN.GenerateLegacyDN(Server.GetParentLegacyDN(scSession), mailboxTransportServer);
                    mailboxTransportServer.CurrentServerRole   = ServerRole.Mailbox;
                    mailboxTransportServer.SetId(childId);
                    base.DataSession.Save(mailboxTransportServer);
                    return;
                }
            }
            else if (array.Length > 0)
            {
                base.DataSession.Delete(array[0]);
            }
        }
        private void SetID()
        {
            ADSite adsite;

            if (this.Site == null)
            {
                adsite = ((ITopologyConfigurationSession)base.DataSession).GetLocalSite();
                if (adsite == null)
                {
                    base.WriteError(new NeedToSpecifyADSiteObjectException(), ErrorCategory.InvalidOperation, this.DataObject);
                }
            }
            else
            {
                adsite = (ADSite)base.GetDataObject <ADSite>(this.Site, base.DataSession, null, new LocalizedString?(Strings.ErrorSiteNotFound(this.Site.ToString())), new LocalizedString?(Strings.ErrorSiteNotUnique(this.Site.ToString())));
                if (adsite == null)
                {
                    return;
                }
            }
            ADObjectId id      = adsite.Id;
            ADObjectId childId = id.GetChildId("EdgeSyncService").GetChildId(this.DataObject.Name);

            this.DataObject.SetId(childId);
        }
        private ExchangeConfigurationUnit CreateOrgConfigurationContainer(ADObjectId enclosureContainerId, OrganizationId targetSharedOrgId, string externalDirectoryOrganizationId, string programId, string offerId, bool isDehydrated, bool isStaticConfigurationShared, string sourceForestFqdn, Guid sourceObjectGuid, Guid sourceObjectExchangeObjectId, ITenantConfigurationSession targetForestTenantSession)
        {
            ExchangeConfigurationUnit exchangeConfigurationUnit = new ExchangeConfigurationUnit();

            exchangeConfigurationUnit.SetId(enclosureContainerId.GetChildId("Configuration"));
            exchangeConfigurationUnit.ExternalDirectoryOrganizationId = externalDirectoryOrganizationId;
            exchangeConfigurationUnit.RelocationStatusDetailsRaw      = RelocationStatusDetails.InitializationStarted;
            exchangeConfigurationUnit.OrganizationStatus        = OrganizationStatus.PendingArrival;
            exchangeConfigurationUnit.RelocationSourceForestRaw = sourceForestFqdn;
            exchangeConfigurationUnit.ProgramId    = programId;
            exchangeConfigurationUnit.OfferId      = offerId;
            exchangeConfigurationUnit.IsDehydrated = isDehydrated;
            exchangeConfigurationUnit.IsStaticConfigurationShared = isStaticConfigurationShared;
            exchangeConfigurationUnit.CorrelationId    = sourceObjectGuid;
            exchangeConfigurationUnit.ExchangeObjectId = sourceObjectExchangeObjectId;
            if (targetSharedOrgId != null)
            {
                exchangeConfigurationUnit.SupportedSharedConfigurations = new MultiValuedProperty <ADObjectId>();
                exchangeConfigurationUnit.SupportedSharedConfigurations.Add(targetSharedOrgId.ConfigurationUnit);
            }
            exchangeConfigurationUnit.Name = "Configuration";
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAccountPartitionRootOrgScopeSet(targetForestTenantSession.SessionSettings.PartitionId), 546, "CreateOrgConfigurationContainer", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Relocation\\NewTenantRelocationRequest.cs");
            string parentLegacyDN = string.Format("{0}{1}", topologyConfigurationSession.GetAdministrativeGroup().LegacyExchangeDN, this.GetRelativeDNTillConfigurationUnits(exchangeConfigurationUnit.Id));

            exchangeConfigurationUnit.LegacyExchangeDN = LegacyDN.GenerateLegacyDN(parentLegacyDN, exchangeConfigurationUnit);
            targetForestTenantSession.Save(exchangeConfigurationUnit);
            return(exchangeConfigurationUnit);
        }
예제 #22
0
        // Token: 0x0600035A RID: 858 RVA: 0x00012274 File Offset: 0x00010474
        public static ADNotificationRequestCookie RegisterExchangeTopologyChangeNotification(ADNotificationCallback callback, object context, ExchangeTopologyScope topologyType)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 387, "RegisterExchangeTopologyChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs");
            ADObjectId childId        = topologyConfigurationSession.ConfigurationNamingContext.GetChildId("CN", "Sites");
            ADObjectId childId2       = childId.GetChildId("CN", "Inter-Site Transports").GetChildId("CN", "IP");
            ADObjectId orgContainerId = topologyConfigurationSession.GetOrgContainerId();

            ADNotificationRequest[] requests;
            switch (topologyType)
            {
            case ExchangeTopologyScope.Complete:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSubnet>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADEmailTransport>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0]
                };
                break;

            default:
                throw new ArgumentException("topologyType", "topologyType");
            }
            return(new ADNotificationRequestCookie(requests));
        }
        private ADObjectId CreateContainer(ADObjectId baseContainer, string coantainerName)
        {
            Container container = new Container();

            container.SetId(baseContainer.GetChildId(coantainerName));
            base.DataSession.Save(container);
            return(container.Id);
        }
예제 #24
0
        protected override IConfigurable PrepareDataObject()
        {
            OutlookProvider outlookProvider = (OutlookProvider)base.PrepareDataObject();
            ADObjectId      parentContainer = OutlookProvider.GetParentContainer(base.DataSession as ITopologyConfigurationSession);

            outlookProvider.SetId(parentContainer.GetChildId(base.Name));
            return(outlookProvider);
        }
예제 #25
0
		public static void SetConnectorId(SendConnector connector, ADObjectId sourceRgId)
		{
			connector.SetId(sourceRgId.GetChildId("Connections").GetChildId(connector.Name));
			TaskLogger.Trace("Set connector ID to '{0}'", new object[]
			{
				connector.Id
			});
		}
예제 #26
0
 internal static ADObjectId GetDeletedObjectsContainer(ADObjectId namingContextId)
 {
     if (namingContextId == null)
     {
         throw new ArgumentNullException("namingContextId");
     }
     return(namingContextId.GetChildId("Deleted Objects"));
 }
        protected override IConfigurable PrepareDataObject()
        {
            IConfigurationSession configurationSession  = (IConfigurationSession)base.DataSession;
            MessageClassification messageClassification = (MessageClassification)base.PrepareDataObject();

            if (!messageClassification.IsModified(ClassificationSchema.RecipientDescription))
            {
                this.RecipientDescription = this.SenderDescription;
            }
            OrFilter filter = new OrFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, base.Name),
                new ComparisonFilter(ComparisonOperator.Equal, ClassificationSchema.ClassificationID, this.ClassificationID)
            });

            MessageClassification[] array = configurationSession.Find <MessageClassification>((ADObjectId)this.RootId, QueryScope.SubTree, filter, null, 1);
            ADObjectId adobjectId         = configurationSession.GetOrgContainerId().GetDescendantId(MessageClassificationIdParameter.MessageClassificationRdn);

            if (this.Locale != null)
            {
                if (array == null || array.Length == 0)
                {
                    base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorDefaultLocaleClassificationDoesNotExist(base.Name)), ErrorCategory.ObjectNotFound, messageClassification);
                }
                else
                {
                    MessageClassification messageClassification2 = array[0];
                    this.DataObject.ClassificationID            = messageClassification2.ClassificationID;
                    this.DataObject.DisplayPrecedence           = messageClassification2.DisplayPrecedence;
                    this.DataObject.PermissionMenuVisible       = messageClassification2.PermissionMenuVisible;
                    this.DataObject.RetainClassificationEnabled = messageClassification2.RetainClassificationEnabled;
                    adobjectId = adobjectId.GetChildId(this.Locale.ToString());
                }
            }
            else
            {
                if (array.Length > 0)
                {
                    string name = array[0].Name;
                    base.WriteError(new ManagementObjectAmbiguousException(Strings.ErrorClassificationAlreadyDefined(name, this.ClassificationID)), ErrorCategory.InvalidOperation, base.Name);
                }
                adobjectId = (ADObjectId)this.RootId;
            }
            messageClassification.SetId(adobjectId.GetChildId(base.Name));
            return(messageClassification);
        }
예제 #28
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            this.DataObject = (ManagementScope)base.PrepareDataObject();
            if (this.ServerRestrictionFilter != null || this.ServerList != null)
            {
                this.DataObject.ScopeRestrictionType = ScopeRestrictionType.ServerScope;
                if (this.ServerList != null && this.ServerList.Length > 0)
                {
                    this.DataObject.ServerFilter = this.BuildAndVerifyObjectListFilter <Server>(this.ServerList, "ServerList", new NewManagementScope.SingleParameterLocString(Strings.ServerNamesMustBeValid), new NewManagementScope.SingleParameterLocString(Strings.ServerNamesMustBeUnique), new NewManagementScope.SingleParameterLocString(Strings.ServerListMustBeValid));
                }
                else
                {
                    this.ValidateAndSetFilterOnDataObject("ServerRestrictionFilter", this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
                }
            }
            else if (this.PartnerDelegatedTenantRestrictionFilter != null)
            {
                this.DataObject.ScopeRestrictionType = ScopeRestrictionType.PartnerDelegatedTenantScope;
                this.ValidateAndSetFilterOnDataObject("PartnerDelegatedTenantRestrictionFilter", this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            else if (this.RecipientRestrictionFilter != null)
            {
                this.DataObject.ScopeRestrictionType = ScopeRestrictionType.RecipientScope;
                this.ValidateAndSetFilterOnDataObject("RecipientRestrictionFilter", this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            else if (this.DatabaseRestrictionFilter != null || this.DatabaseList != null)
            {
                this.DataObject.ScopeRestrictionType = ScopeRestrictionType.DatabaseScope;
                if (this.DatabaseList != null && this.DatabaseList.Length > 0)
                {
                    this.DataObject.DatabaseFilter = this.BuildAndVerifyObjectListFilter <Database>(this.DatabaseList, "DatabaseList", new NewManagementScope.SingleParameterLocString(Strings.DatabaseNamesMustBeValid), new NewManagementScope.SingleParameterLocString(Strings.DatabaseNamesMustBeUnique), new NewManagementScope.SingleParameterLocString(Strings.DatabaseListMustBeValid));
                }
                else
                {
                    this.ValidateAndSetFilterOnDataObject("DatabaseRestrictionFilter", this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
                }
                this.DataObject.SetExchangeVersion(ManagementScopeSchema.ExchangeManagementScope2010_SPVersion);
            }
            if (this.Exclusive.ToBool())
            {
                this.DataObject.Exclusive = true;
            }
            IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession;

            this.DataObject.RecipientRoot = null;
            if (this.RecipientRoot != null)
            {
                this.DataObject.RecipientRoot = this.GetADObjectIdFromOrganizationalUnitIdParameter(configurationSession, this.RecipientRoot);
            }
            if (!base.HasErrors)
            {
                ADObjectId rootContainerId = ManagementScopeIdParameter.GetRootContainerId(configurationSession);
                this.DataObject.SetId(rootContainerId.GetChildId(base.Name));
            }
            TaskLogger.LogExit();
            return(this.DataObject);
        }
예제 #29
0
        protected override IConfigurable PrepareDataObject()
        {
            TDataObject tdataObject = (TDataObject)((object)base.PrepareDataObject());
            ADObjectId  adobjectId  = this.RootId as ADObjectId;

            tdataObject.SetId(adobjectId.GetChildId(tdataObject.Name));
            tdataObject.LogFileLocation = Path.Combine(this.GetLoggingPath(), this.ProtocolName);
            return(tdataObject);
        }
예제 #30
0
        private ADObjectId ResolveAddressListId(ADObjectId rootContainerId, string[] commonName)
        {
            ADObjectId adobjectId = rootContainerId;

            for (int i = 0; i < commonName.Length; i++)
            {
                adobjectId = adobjectId.GetChildId(commonName[i]);
            }
            return(adobjectId);
        }