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); }
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); }