Section 3: Create Sandboxed Web Part to Surface Azure Web Role
SharePoint 2010 introduced a new way to deploy custom code solutions to SharePoint in a protected way: sandbox solutions. These solutions are limited in scope to what they can do and what they can access as a trade-off to a mode secure and stable SharePoint server. These tradeoffs can sometimes limit businesses from solving certain business requirements. One way to address this is to create an application that runs external to SharePoint, such as in Windows Azure (like the one created in the previous labs). The application can then be surfaced in SharePoint 2010 using a sandbox solution Web Part that displays an IFrame.
In this lab, you will:
You must have the following items to complete this lab:
This Hands-On Lab is comprised of the following exercises:
Estimated Time to complete this lab: 60 minutes
Exercise 1: Create Sandboxed Web Part
In this exercise, you will create a sandbox solution that contains a new Web Part that renders an IFrame which will display the contents of the site..
Task 1 – Creating The New Workflow Project
In this task, you will create the new empty SharePoint 2010 project.
Task 2 – Creating a Web Part SharePoint Project Item
In this task, you will create a Web Part SharePoint Project Item that will serve as the host for the Windows Azure Web Role.
Exercise 2: Add Public Properties to Sandboxed Web Part
In this exercise, you will update the sandboxed Web Part created in the previous exercise to have configurable public properties that will allow users with appropriate rights to specify the URL of the hosted Windows Azure application.
Task 1 – Adding a Configurable Windows Azure URL Destiation to the Web Part
In this task, you will add a new public property that will allow users to specify the URL of the Windows Azure application.
Exercise 3: Deploy and Test Sandboxed Web Part
In this exercise, you will deploy and test the final sandboxed Web Part.
Task 1 – Deploying the Sandboxed Web Part
In this task, you will deploy the Sandboxed Web Part.
Task 2 – Configuring the Web Part to Load the Azure Web Role
In this task, you will configure the Web Part to load the Azure Web Role project.
Using a sandbox solution in SharePoint 2010, developers can deploy custom code solutions to SharePoint site collections without involving the server or farm administrators. However this capability comes with tradeoffs in that developers do not have the ability to do everything they could normally do with farm solutions. Such things include communicating with Web services or databases. One technique to still deploy using the sandbox solution model but to break free from it’s limitations is to create a sandboxed Web Part that renders an IFrame control that displays an application running in Windows Azure.