Integrating SharePoint & Azure with CloudShare (Part II)
danielle
Jun 21, 2012
- 4 min read
Last week, I explained how to integrate SharePoint & Windows Azure with CloudShare (read the full post here). Today, I will show you how to integrate Windows Azure Marketplace data in SharePoint 2010 sites through a Business Connectivity Service (BCS) connector. The BCS connector is created in Visual Studio 2012 RC (VS 2012 RC) and deployed to a SharePoint 2010 farm.
Before we begin, I recommend that you review the definition and goals of the Windows Azure Marketplace on its web portal. It is defined as, “an online market for the buying and selling of finished Software as a Service (SaaS) applications and premium datasets. The Windows Azure Marketplace helps connect companies seeking innovative cloud based solutions with partners who have developed solutions that are ready to use.”
- In order to integrate the Windows Azure Data Marketplace with your CloudShare SharePoint 2010 farm, you will need to create a Windows Azure Marketplace account. This can be done using a Windows Live ID. Once you have signed in, the first thing you should know is how to integrate available data in the marketplace. I will use the dataset, “2006 – 2008 Crime in the United States.” This can be integrated with our applications easily by referencing the service with the data: https://api.datamarket.azure.com/data.gov/Crimes/
- Windows Azure Marketplace allows you to subscribe to datasets like this one and evaluate the information that has been populated:
- Once we have added the dataset to our Windows Azure Marketplace account, we are ready to create the BCS connector. Open VS 2012 RC and create a SharePoint 2010 Project. In VS 2012 RC, add a Business Data Connectivity (BDC) model element to your project. This model will contain a single entity – Crime – which will display the dataset.
- Instead of working with the BDC Model Designer, we’ll write the business logic to access to the data service. First, add a reference to the service and to the System.Data.Services.Client assembly in the Solution Explorer. All classes needed to work with OData services will be available.
- The project contains two classes – Entity1 and Entity1Service . We have to modify to add the business logic. Entity1 class defines a base entity with all properties needed to integrate the data. Entity1Service defines members and methods that will allow for the reading of the data. Rename Entity1 to Crime and Entity1Service to CrimeService.
- Edit the Crime.cs file and add the following properties to the Crime class (Note: these properties map the ones defined in the BDC Model through the model designer and the model explorer):
- Edit the CrimeService.cs file and add directives to System.Net, System.Data.Services.Client and the Crime service. In order to work with the service, we have to write a method that returns a service proxy. (Note: you must take care of SSL connections when calling a Marketplace service by using the ServicePointManager class and Windows Azure Marketplace certificates. This service proxy returned allows us to access the data. You must also specify your Datamarket key and account in order to be able to successfully connect to the Crime service.)
- The CrimeService class uses two methods: a “specific finder” method and a “finder” one. The first method allows us to return a single Crime entity through a unique identifier, run as a query parameter.
- The second method returns a collection of Crime entities:
- When we finish coding Crime and CrimeService classes, we have to ensure the BDC model includes the same properties and methods implemented in both classes. This work is done through the BDC model designer in VS 2012 RC.
- Once everything is done, build your project and deploy the BCS connector to your SharePoint farm. (Note: a BCS connector is installed and deployed as a farm feature). Finally, if the BCS service application has been configured properly, you can create an external list based on the BCS connector and test that the data is displayed:
We’ve just integrated Azure services and SharePoint with CloudShare. In future articles, I will show you how to integrate other Azure data/services in a CloudShare SharePoint environment. Happy CloudSharing!