Recently Microsoft launches there latest innovation from Live Labs named Pivots. Pivots is an application for visualizing rich amount of data by using the PivotViewer Silverlight control. The control allows you to categorize your data based on the metadata it retrieves. By using the Silverlight DeepZoom technology, image collections will become alive.
So how cool would it be if we could use SharePoint 2010 as a data provider and host for the PivotsViewer Silverlight Control?
The Pivots SDK ships with a CXML HttpHandler that loads all factory classes from the application bin folder. One of the provided factory classes is based on the OData protocol. The OData protocol is a REST based protocol which is increasing in popularity and is used in several Microsoft products like Azure and SharePoint 2010. The ListData.svc services in SharePoint 2010 can be used for retrieving collections (all the libraries) and the items of the collection (all the items of a library). When an item contains an image URL, it will automatically render a DeepZoom Collection. For items that not contain an image, it will render a box containing the title of the item.
Take a look at the video.
The solution
The solution contains a proof of concept implementation of the Live Labs Pivot with SharePoint 2010. It includes 2 library projects and 2 SharePoint projects for deploying the solution to SharePoint.
The SharePointPivots solution contains the PivotSilverlightWebpart and the registration of the 5 HttpHandlers. The actual implementation of the handlers can be found in the PivotServerTool library project.
The SharePointPivots.Install solution is responsible for the registration of the HttpHandlers in the Web.config . The Web.Config modifications are done by the WebConfigModifications feature. The feature contains a FeatureReceiver which uses the SPWebConfigMoifications class to update the web.config.
The SharePoint project contains the Silverlight XAP file which will be deployed to the Layouts directory. I didn’t include the Silverlight file itself because it requires the Silverlight 4 Development tools. If you are interested in the Silverlight project, simple download the SDK from the Microsoft Live Labs Pivot SDK here. http://www.getpivot.com/developer-info/jit-tools.aspx.
The PivotServerTools project comes from the SDK example and contains helper classes for the HttpHandlers.
The CollectionFactories project comes from the SDK example as well. It contains so called CollectionFactory classes. These classes are responsible for retrieving the data and mapping the items to Facet classes. The SDK ships with CollectionFactory classes for Sql, FileSystem images, SQL Azure, Twitter and as previously mentioned OData.
Deploy
You can either deploy both WSP solutions by using STSADM or you can use Visual Studio 2010 to deploy the Solutions. The SharePointPivots.wsp will be deployed to the application bin folder. Because of that, it needs a CAS policy. I didn’t include the CAS policy because the deployment in Visual Studio 2010 will fail when you add a CAS policy to the manifest. This is a known issue as stated here http://support.microsoft.com/kb/2022463.
To keep thing simple you can set the trust level of your webapplication to full. Update the web.config with: <trust level="Full" originUrl="" />
If you don’t like this (which is good!), update the manifest with a CAS policy and deploy the solutions by using STSADM or powershell.
Once deployed, go to Central Admin and deploy the SharePointPivots.Install solution to the webapplication you want. Let’s say http://intranet. This will add the HttpHandlers sections to the web.config of the webapplication.
Go to the website http://intranet and make sure the sitecollection feature SharePointPivots Webpart is activated. Now its time to add the SharePointPivots webpart to the page. Go to any page you want and add the webpart to the page. Configure the webpart by going to the Edit Webpart properties.
Go to the property “Select a Factory Provider”. Choose “OData.cxml?src=http://intranet” and click the Apply button.
Trouble shooting
If you don’t get any data returned by the listdata.svc service, check if the ADO.NET data services are installed correctly. To do so, simple run any url with /_vti_bin/listdata.svc. If it gives the exception “Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider” reinstall an update of the ADO.NET dataservices from http://support.microsoft.com/kb/976127
Have fun but keep in mind it is still a proof of concept implemention!