public UsersObject GetUserMailbox(string identity) { ExchangePowershell powershell = null; try { powershell = new ExchangePowershell(StaticSettings.ExchangeURI, StaticSettings.Username, StaticSettings.DecryptedPassword, StaticSettings.ExchangeUseKerberos, StaticSettings.PrimaryDC); UsersObject obj = powershell.GetUser(identity, StaticSettings.ExchangeVersion); return obj; } catch (Exception ex) { this.logger.Error("Failed to retrieve user mailbox information " + identity, ex); ThrowEvent(AlertID.FAILED, ex.Message); return null; } finally { if (powershell != null) powershell.Dispose(); } }