Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
        internal static bool IsTenantAddressList(IConfigurationSession session, ADObjectId id)
        {
            string accountOrResourceForestFqdn = session.SessionSettings.GetAccountOrResourceForestFqdn();

            return(ADSession.IsTenantIdentity(id, accountOrResourceForestFqdn));
        }