示例#1
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);
        }
示例#2
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);
        }