Reference Implementation: Full-Trust Proxies for Sandboxed Solutions
Full-trust proxies allow you to expose additional functionality to your SharePoint applications while maintaining many of the benefits of the sandbox environment. The Sandbox Reference Implementation (Sandbox RI) includes a sandboxed solution that retrieves statement of work (SOW) documents and estimations from multiple lists in a site collection. The solution includes a Web Part that displays a summary of the aggregated content in a central location. The Full-Trust Proxy Reference Implementation (Full-Trust Proxy RI) extends the list aggregation scenario to supplement the aggregated data with accounts payable information from a vendor system. The solution uses a full-trust proxy that connects to an Enterprise resource planning (ERP) Web service and retrieves information about the current vendor.
The Full-Trust Proxy RI highlights details and best practices in the following areas:
- Creating, deploying, and registering a full-trust proxy
- Consuming a full trust proxy from sandboxed code
- Deploying pages and client-side scripts to the sandbox environment
- Launching pages as modal dialogs from the sandbox environment
Note
This solution builds on the Sandbox Reference Implementation. The documentation for the Sandbox RI describes many issues—such as feature partitioning, exception shielding, and the use of various design patterns—that are not repeated in this topic. We recommend that you familiarize yourself with the documentation for the Sandbox RI before you review this topic.
Solution Scenario
In this example, suppose you are a SharePoint consultant working for a pharmaceutical company named Contoso Inc. You have already designed and implemented a sandboxed solution that aggregates list data from across the site collection for the Springfield manufacturing plant, as described in the Sandbox Reference Implementation. The solution includes a Web Part that displays an approval status and an estimated value for work items from various departments within the Springfield plant.
The head of the Springfield plant, Janet Schorr, now wants you to extend this solution. In addition to a summary of approval status and estimated value, Janet wants to be able to view details of the vendor associated with each work item. In particular, Janet wants to be able to view the amount owed (accounts payable) to the vendor to make sure the plant is balancing work across preferred vendors.
At present, this vendor information is stored in Contoso's ERP system. The ERP system exposes various Web services that allow external systems to retrieve and interact with financial data, including the retrieval financial information related to vendors. To meet Janet’s requirements, you implement a full-trust proxy that interacts with the ERP Web services for vendor data. You then modify your sandboxed solution to use this full-trust proxy to retrieve and display client details. The user can click the name of a vendor to launch a modal dialog that displays the amount currently owed to the vendor, as shown in the following illustrations.
Full Trust Proxy RI user interface
Deploying the Full-Trust Proxy RI
The Full-Trust Proxy RI includes an automated installation script that creates a site collection, deploys the reference implementation components, and adds sample data. After running the installation script, browse to the new SpringfieldProxy site collection at http://<Hostname>/sites/SpringfieldProxy. You can open and run the project in Visual Studio, but this does not create a site collection or add sample data. To see the system fully functioning, you must run the installation script. The following table summarizes how to get started with the Full-Trust Proxy RI.
Question |
Answer |
---|---|
Where can I find the Full-Trust Proxy RI? |
<install location>\Source\ExecutionModel\Proxy |
What is the name of the solution file? |
ExecutionModels.Sandboxed.Proxy.sln |
What are the system requirements? |
SharePoint Foundation 2010 |
What preconditions are required for installation? |
|
How do I Install the Full-Trust Proxy RI? |
Follow the instructions in the Readme.txt file located in the project folder. |
What is the default installation location? |
http://<Hostname>/sites/SpringfieldProxy (This location can be altered by changing the Settings.xml in the Setup directory.) |
How do I download the Full-Trust Proxy RI? |
The Full-Trust Proxy RI is included in the download Developing Applications for SharePoint 2010. |