/// <summary> /// Removes a public folder from a company /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDisableYes_Click(object sender, EventArgs e) { ExchCmds powershell = null; try { // Initialize powershell = new ExchCmds(Config.ExchangeURI, Config.Username, Config.Password, Config.ExchangeConnectionType, Config.PrimaryDC); // Remove public folder powershell.Remove_PublicFolder(CPContext.SelectedCompanyCode); // Remove from SQL SQLPublicFolders.Update_PublicFolderForCompany(CPContext.SelectedCompanyCode, false); // Update notification notification1.SetMessage(controls.notification.MessageType.Success, "Successfully disabled public folders for your company"); // Change view panelDisablePublicFolders.Visible = false; panelEditPublicFolders.Visible = false; panelEnablePublicFolders.Visible = true; } catch (Exception ex) { notification1.SetMessage(controls.notification.MessageType.Error, "Failed to remove public folders. Please contact support: " + ex.Message); } finally { if (powershell != null) powershell.Dispose(); } }