private bool DeleteField(SPListEventProperties properties) { bool isSuccessful = true; string tableName = string.Empty; string ssTableName = string.Empty; var rb = new ReportBiz(properties.SiteId); try { var rd = new ReportData(properties.SiteId); var cols = new ColumnDefCollection(); //ColumnDef cd = new ColumnDef(properties.Field); tableName = rd.GetTableName(properties.ListId); ssTableName = rd.GetTableNameSnapshot(properties.ListId); cols.AddColumn(properties.Field); rd.DeleteColumns(tableName, cols); rd.DeleteColumns(ssTableName, cols); rd.DeleteListColumns(properties.ListId, cols); rd.Dispose(); } catch (Exception ex) { var DAO = new EPMData(properties.SiteId); DAO.LogStatus(properties.ListId.ToString(), properties.FieldName, "Database column delete attempt: Unable to column " + properties.FieldName + ". " + ex.Message, ex.StackTrace, 2, 5, Guid.NewGuid().ToString()); //Logged in the RefreshAll event log. DAO.Dispose(); } if (properties.Field is SPFieldLookup) { try { //FOREIGN IMPLEMENTATION -- START var DAO = new EPMData(properties.SiteId); rb.UpdateForeignKeys(DAO); DAO.Dispose(); // -- END } catch (Exception ex) { isSuccessful = false; SPSecurity.RunWithElevatedPrivileges(delegate { if (!EventLog.SourceExists("EPMLive Reporting - UpdateForeignKeys")) { EventLog.CreateEventSource("EPMLive Reporting - UpdateForeignKeys", "EPM Live"); } LogEntry(ex, "EPMLive Reporting - UpdateForeignKeys"); }); } } return(isSuccessful); }