public static ExchangeConfigurationUnit GetExchangeConfigurationUnit(ADObjectId organizationMailboxId) { if (!ADSession.IsTenantIdentity(organizationMailboxId, organizationMailboxId.GetPartitionId().ForestFQDN)) { throw new InvalidOperationException(); } ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsObjectId(organizationMailboxId); ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 495, "GetExchangeConfigurationUnit", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OrganizationMailbox\\OrganizationMailbox.cs"); ExchangePrincipal exchangePrincipal = OrganizationMailbox.GetExchangePrincipal(organizationMailboxId); return(tenantConfigurationSession.Read <ExchangeConfigurationUnit>(exchangePrincipal.MailboxInfo.OrganizationId.ConfigurationUnit)); }
private static ExchangePrincipal GetExchangePrincipal(ADObjectId organizationMailboxId) { IRecipientSession recipientSession; if (ADSession.IsTenantIdentity(organizationMailboxId, organizationMailboxId.GetPartitionId().ForestFQDN)) { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsObjectId(organizationMailboxId); recipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(null, null, LcidMapper.DefaultLcid, true, ConsistencyMode.IgnoreInvalid, null, sessionSettings, 515, "GetExchangePrincipal", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OrganizationMailbox\\OrganizationMailbox.cs"); } else { ADSessionSettings sessionSettings2 = ADSessionSettings.FromRootOrgScopeSet(); recipientSession = DirectorySessionFactory.Default.CreateRootOrgRecipientSession(null, null, LcidMapper.DefaultLcid, true, ConsistencyMode.IgnoreInvalid, null, sessionSettings2, 528, "GetExchangePrincipal", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OrganizationMailbox\\OrganizationMailbox.cs"); } ADUser aduser = recipientSession.Read(organizationMailboxId) as ADUser; if (aduser == null) { throw new ADNoSuchObjectException(DirectoryStrings.OrganizationMailboxNotFound(organizationMailboxId.ToString())); } return(ExchangePrincipal.FromADUser(aduser, RemotingOptions.AllowCrossSite)); }
internal static EphemeralIdTable.NamingContext GetNamingContext(ADObjectId id) { if (id.IsDescendantOf(ADSession.GetConfigurationNamingContext(id.GetPartitionId().ForestFQDN))) { if (!ADSession.IsTenantIdentity(id, id.GetPartitionId().ForestFQDN)) { return(EphemeralIdTable.NamingContext.Config); } return(EphemeralIdTable.NamingContext.TenantConfig); } else { if (!ADSession.IsTenantIdentity(id, id.GetPartitionId().ForestFQDN)) { return(EphemeralIdTable.NamingContext.Domain); } if (!id.IsDescendantOf(ADSession.GetConfigurationUnitsRoot(id.GetPartitionId().ForestFQDN))) { return(EphemeralIdTable.NamingContext.Domain); } return(EphemeralIdTable.NamingContext.TenantConfig); } }
internal static bool IsTenantAddressList(IConfigurationSession session, ADObjectId id) { string accountOrResourceForestFqdn = session.SessionSettings.GetAccountOrResourceForestFqdn(); return(ADSession.IsTenantIdentity(id, accountOrResourceForestFqdn)); }