예제 #1
0
        /// <summary>
        /// Deletes the group from Exchange and SQL where from the panel that asks the user if they are sure they want to delete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDeleteYes_Click(object sender, EventArgs e)
        {
            ExchCmds powershell = null;

            try
            {
                // Initialize
                powershell = new ExchCmds(Config.ExchangeURI, Config.Username, Config.Password, Config.ExchangeConnectionType, Config.PrimaryDC);

                // Delete group from Exchange
                powershell.Remove_DistributionGroup(hfDeleteDistributionGroup.Value);

                // Remove from SQL
                SQLExchange.RemoveGroup(hfDeleteDistributionGroup.Value);

                // Update notification
                notification1.SetMessage(controls.notification.MessageType.Success, Resources.LocalizedText.NotificationSuccessDeleteGroup);
            }
            catch (Exception ex)
            {
                notification1.SetMessage(controls.notification.MessageType.Error, ex.Message);
            }
            finally
            {
                // Refresh to the main distribution group list panel
                GetDistributionGroups();
            }
        }