Juan Carlos

Integrating SharePoint & Azure with CloudShare (Part II)

June 21st, 2012 | Author: | Filed under: CloudShare, Dev / Test | Tags: , , , , , , ,


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!

About the author:
With 8 years of experience in the TIC sector, what best define me is the interest and knowledge of new technologies as a natural way for attending and solving customer problems and needs. Mi career in the TIC sector, and particularly in the .NET platform started in 2003, just after finishing my studies at the university, in the global worldwide consultancy company Accenture. There, I had the opportunity of working during 3 years in big national and international projects performing different task and roles: development of VB.NET applications, application test and deployment, management of small development teams and so on. In May 2006 I left Accenture and started a new adventure at the Microsoft Innovation Center in Cantabria (CIIN) as a Solutions Architect. In this new stage, I have had the opportunity of knowing deeply a variety of Microsoft technologies such as SharePoint, Office 365, Windows Azure, Visual Studio, SQL Server Reporting Services, BizTalk, LINQ, Entity Framework, etc. At the CIIN I perform evangelism activities just around these technologies, and I have the honor of belonging to one of the more specialized organizations in SharePoint in Spain.