public static void GetOrganizationMailboxesByCapability(IRecipientSession session, OrganizationCapability capability, ADObjectId siteId, out List <ADUser> filteredList, out List <ADUser> completeList)
 {
     ExAssert.RetailAssert(!OrganizationMailbox.IsMultiTenantEnvironment(), "GetOrganizationMailboxesByCapability (site-based) should not be used in Datacenter Multitenant environment");
     ExTraceGlobals.StorageTracer.TraceDebug <OrganizationCapability>(0L, "Entering GetOrganizationMailboxByCapability capability='{0}'", capability);
     if (siteId == null)
     {
         throw new ArgumentNullException("siteId");
     }
     completeList = OrganizationMailbox.GetOrganizationMailboxesByCapability(session, capability);
     ExTraceGlobals.StorageTracer.TraceDebug <int, OrganizationCapability>(0L, "GetOrganizationMailboxByCapability -completeList of mailbox, count='{0}', capability='{1}'", completeList.Count, capability);
     filteredList = new List <ADUser>();
     if (completeList.Count > 0)
     {
         ExTraceGlobals.StorageTracer.TraceDebug <OrganizationCapability>(0L, "GetOrganizationMailboxByCapability -GetCurrentServiceTopology capability='{0}'", capability);
         ServiceTopology currentServiceTopology = ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OrganizationMailbox\\OrganizationMailbox.cs", "GetOrganizationMailboxesByCapability", 137);
         foreach (ADUser aduser in completeList)
         {
             ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(session.SessionSettings, aduser, RemotingOptions.AllowCrossSite);
             string            serverFqdn        = exchangePrincipal.MailboxInfo.Location.ServerFqdn;
             ExTraceGlobals.StorageTracer.TraceDebug <string, OrganizationCapability>(0L, "GetOrganizationMailboxByCapability calling GetSite with Prinicipal.ServerFQDN='{0}', capability='{1}'", serverFqdn, capability);
             Site site       = currentServiceTopology.GetSite(serverFqdn, "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OrganizationMailbox\\OrganizationMailbox.cs", "GetOrganizationMailboxesByCapability", 151);
             Guid objectGuid = site.Id.ObjectGuid;
             ExTraceGlobals.StorageTracer.TraceDebug <string, Guid, OrganizationCapability>(0L, "GetOrganizationMailboxByCapability  GetSite called with Prinicipal.ServerFQDN='{0}', Site='{1}'capability='{2}'", serverFqdn, objectGuid, capability);
             if (siteId.ObjectGuid.Equals(objectGuid))
             {
                 filteredList.Add(aduser);
             }
         }
     }
 }
Example #2
0
        private string GetSharingUrl(ADUser user, IFrontEndLocator frontEndLocator)
        {
            ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(user, null);

            if (exchangePrincipal.MailboxInfo.Location.ServerVersion >= Server.E15MinVersion && this.IsMultitenancyEnabled)
            {
                return(this.GetE15MultitenancySharingUrl(exchangePrincipal, frontEndLocator));
            }
            return(this.GetEnterpriseOrE14SharingUrl(exchangePrincipal));
        }
 public static void GetOrganizationMailboxesByCapability(IRecipientSession session, OrganizationCapability capability, int minVersion, int maxVersion, out List <ADUser> filteredList, out List <ADUser> completeList)
 {
     completeList = OrganizationMailbox.GetOrganizationMailboxesByCapability(session, capability);
     filteredList = new List <ADUser>();
     foreach (ADUser aduser in completeList)
     {
         ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(session.SessionSettings, aduser, RemotingOptions.AllowCrossSite);
         if (exchangePrincipal.MailboxInfo.Location.ServerVersion >= minVersion && exchangePrincipal.MailboxInfo.Location.ServerVersion < maxVersion)
         {
             filteredList.Add(aduser);
         }
     }
 }
Example #4
0
        public virtual List <AggregatedAccountInfo> GetListOfAccounts()
        {
            AggregatedAccountListConfiguration aggregatedAccountListConfiguration = new AggregatedAccountListConfiguration
            {
                Principal = ExchangePrincipal.FromADUser(this.adUser, null)
            };
            MailboxStoreTypeProvider mailboxStoreTypeProvider = new MailboxStoreTypeProvider(this.adUser)
            {
                MailboxSession = this.session
            };

            aggregatedAccountListConfiguration = (aggregatedAccountListConfiguration.Read(mailboxStoreTypeProvider, null) as AggregatedAccountListConfiguration);
            if (aggregatedAccountListConfiguration.AggregatedAccountList == null)
            {
                return(new List <AggregatedAccountInfo>());
            }
            return(aggregatedAccountListConfiguration.AggregatedAccountList);
        }
Example #5
0
        public virtual void RemoveAccount(SmtpAddress smtpAddress)
        {
            Util.ThrowOnNullArgument(smtpAddress, "smtpAddress");
            AggregatedAccountListConfiguration aggregatedAccountListConfiguration = new AggregatedAccountListConfiguration();

            aggregatedAccountListConfiguration.Principal = ExchangePrincipal.FromADUser(this.adUser, null);
            MailboxStoreTypeProvider mailboxStoreTypeProvider = new MailboxStoreTypeProvider(this.adUser)
            {
                MailboxSession = this.session
            };
            List <AggregatedAccountInfo> listOfAccounts        = this.GetListOfAccounts();
            AggregatedAccountInfo        aggregatedAccountInfo = listOfAccounts.Find((AggregatedAccountInfo o) => o.SmtpAddress == smtpAddress);

            if (aggregatedAccountInfo == null)
            {
                return;
            }
            aggregatedAccountListConfiguration.RequestGuid = aggregatedAccountInfo.RequestGuid;
            aggregatedAccountListConfiguration.Delete(mailboxStoreTypeProvider);
        }
Example #6
0
        public virtual AggregatedAccountInfo AddAccount(SmtpAddress smtpAddress, Guid aggregatedMailboxGuid, Guid requestGuid)
        {
            Util.ThrowOnNullArgument(smtpAddress, "smtpAddress");
            AggregatedAccountListConfiguration aggregatedAccountListConfiguration = new AggregatedAccountListConfiguration();

            aggregatedAccountListConfiguration.Principal = ExchangePrincipal.FromADUser(this.adUser, null);
            MailboxStoreTypeProvider mailboxStoreTypeProvider = new MailboxStoreTypeProvider(this.adUser)
            {
                MailboxSession = this.session
            };

            this.AccountMailboxGuid = aggregatedMailboxGuid;
            AggregatedAccountInfo result = new AggregatedAccountInfo(this.AccountMailboxGuid, smtpAddress, requestGuid);

            aggregatedAccountListConfiguration.RequestGuid           = requestGuid;
            aggregatedAccountListConfiguration.SmtpAddress           = smtpAddress;
            aggregatedAccountListConfiguration.AggregatedMailboxGuid = this.AccountMailboxGuid;
            aggregatedAccountListConfiguration.Save(mailboxStoreTypeProvider);
            return(result);
        }
        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));
        }