Anybody that has worked with Microsoft SharePoint as a developer knows that it can be an exercise in frustration for the strangest of reasons. One only has to see a handful of helpful error messages such as “An unexpected error has occurred” to understand exactly what I mean.
Yes, one may look through the logs to find more details about the error that occurred, but in most cases this requires a Correlation ID, which in many circumstances SharePoint neglects to make known. Without this 32-digit, difficult-to-remember hexadecimal value, finding the error that occurred can be very difficult (if not impossible in some circumstances). At least SharePoint will reward a diligent developer with a stack trace for a job well done.
After 5 months of SharePoint training, development, research, and a certification, I don’t think I’ve become much better at SharePoint development. Writing the code is the easy part. What I have become better at is fixing the errors, and avoiding some errors altogether.
Dealing with SharePoint Errors
Starting out, the best thing one can do is learn to use the logs, which are buried deep within the catacombs of the Program Files directory. If SharePoint doesn’t issue a correlation ID, search for exceptions around the same time period in which the error occurred.
When you find the exception type which was thrown, Google it! If you can’t find the error in the log, Google it! At least ten thousand developers have experienced the same issue, and number of them have either recorded the solution in a blog or posted on a message board, where someone else posted the answer. When armed with knowledge, nothing can take down a .NET developer.
Keep watching this space in the future, as I plan on covering a wide range of SharePoint 2007 and 2010 topics, including user experience, administration, and development, along with other struggles I come across along the way, all of which in the hopes of keeping you from making the same mistakes as me.
In case you’re wondering, here’s where the logs are located. You can see why I didn’t put them in the body of the article:
- SharePoint 2007: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS\
- SharePoint 2010: C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\LOGS\