Write error to log

28/10/2012 18:46

//define category, not needed to use static or internal

//Area will be 'Unknown' in this case

 

internal static SPDiagnosticsCategory category =
            new SPDiagnosticsCategory("Approve Files", TraceSeverity.Unexpected, EventSeverity.Error);
 
try
                    {
                        file.Approve("Approved by code.");
                    }
                    catch (Exception ex)
                    {
                        SPDiagnosticsService.Local.WriteTrace(0, category, TraceSeverity.Unexpected, "Aconcagua.Lukas.CustomActionMenuWithCode" + ex);
                        throw;
                    }