Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }