Exercise 2 – Logging Exceptions
Task 1 – Create Visual Web Part to throw a SharePoint exception
In this task, you will create a visual web part that will throw and catch an exception. Since developers using SharePoint Online will not have access to the ULS logs of any unhandled exceptions, developers must be proactive with their exception handling. In the case of this lab, you will be catching the exception. In later tasks, you will be logging the details of the exception to a SharePoint list using a custom, common exception handling assembly.
Task 2 – Create a class library to handle SharePoint exceptions
In this task, you will create a class library to handle all SharePoint exceptions. Developers can simply include this class in their SharePoint solutions and pass all caught exceptions to this class for appropriate handling.
Task 3 – Log exceptions from the SharePoint Visual Web with the Utilities project
Task 4 – Test the solution on-premises
In this task, you will deploy your solution to your on premise SharePoint installation and test the exception handling.
Task 5 – Test the solution in SharePoint Online