Create hybrid connectivity apps for SharePoint
Updated: May 7, 2013
Learn about the process of developing and deploying apps for SharePoint 2013 hybrid connectivity solutions.
Applies to: SharePoint Foundation 2013 | SharePoint Server 2013 | SharePoint Online | apps for SharePoint
As businesses move to using SharePoint Online, they need a way to expose large amounts of proprietary data safely and securely. To help solve this challenge, SharePoint 2013 introduced hybrid connectivity.
The Business Connectivity Services (BCS) hybrid connectivity capability lets SharePoint 2013 consume data housed on-premises, inside corporate firewalls, and secured by various forms of authentication. With hybrid connectivity functionality, SharePoint Online can access this data securely over the web as if it was on the same internal network. Once hybrid connectivity is configured, users can work with data that is secured within the business’ infrastructure. They can access and manipulate the data according to the permissions that they have been granted in SharePoint 2013.
For a complete description of how to configure a working hybrid solution, see Hybrid for SharePoint Server 2013. This series of articles walks you through all the requirements of configuring data sources, reverse proxies, search, security, networking, and everything else needed to set up the end-to-end scenario.
To configure a hybrid SharePoint environment, you need a combination of expert skills and significant hands-on experience with SharePoint Server 2013, SharePoint Online, and related products and technologies. We recommend that you engage Microsoft Consulting Services to provide technical guidance and support during the design and deployment of your hybrid environment.
For more information, see Microsoft Services.
For you to be able to create an app that consumes data from an internal data source through BCS and the hybrid connection, this article assumes that you have already followed the procedures to configure your hybrid environment.
Creating a hybrid app for SharePoint is essentially the same as creating any app for SharePoint.
Follow these steps to create a hybrid app:
Prepare the data source
Most of the time, the data source is already in place and is servicing any number of business applications. However, that data may only be available from inside the corporate security infrastructure. If your data does exist on a server located on the inside of a corporate firewall, or is secured by some other means, the next step is to expose that data to BCS, which is also housed inside the firewall. A network device is configured to translate calls from SharePoint Online to the internal SharePoint farm. This device is referred to as a "reverse proxy" and allows the app for SharePoint located in the cloud to call into BCS located inside the firewall. BCS handles all the data connectivity from there.
To make this data available to BCS, you should expose it as an OData source. You do this by creating an Internet Information Services (IIS) website that will host the service and allow BCS to talk to the data source through OData and Representational State Transfer (REST) endpoints.
To create an OData endpoint, you will need to follow these steps for creating a Windows Communication Foundation (WCF) data service.
To create a WCF data service
Create an IIS website running at least Microsoft .NET Framework 4. Secure the site using basic authentication.
It’s not necessary for SharePoint to be installed on this server. In fact, for the sake of simplicity and performance, it’s better if SharePoint is not installed on the server that hosts the WCF data service.
Create a new project in Visual Studio 2012 using the ASP.NET Empty Web Application template.
In Solution Explorer add a new ADO.NET Entity Data Model.
Choose the Generate from database option in the Entity Data Model Wizard.
Select an existing connection, or create a new one.
Provide the URL and connection security information.
Select the items that you want to include in the model, and choose Finish.
Again in Solution Explorer, add a new WCF Data Service using the Visual Studio template.
Name the data service, and choose Next.
At this point, the entity model will be created and the resulting classes will be included in your project.
Set the security to the entities created by replacing the /* TODO: put your data source class name here */ with the class name of the entity model you just created and specifying which entities you want to grant permissions to.
For a complete tutorial of how to set this up, see the following:
Create an app for SharePoint
One of the assumptions we are making here is that you are developing your app inside the corporate firewall. This represents a scenario where a developer working for a company would have a computer located behind the protection of the security infrastructure, developing and testing the app until it is ready to be deployed. This simplifies the process of connecting to the data source from Visual Studio, and uses Office Developer Tools for Visual Studio 2012 to automatically generate the external content type in the next step.
To create a new app
Open Visual Studio 2012 on your development computer that has Office Developer Tools for Visual Studio 2012 and SharePoint 2013 installed.
Create a new app for SharePoint.
Specify the name of the app, the local SharePoint URL that will host your site for testing, and how you want the app to be hosted. Choose Finish.
For complete information about building apps for SharePoint, see Build apps for SharePoint.
Create an external content type
To add a BDC model or external content type to your project, do the following.
To add an external content type
With your new project still open, open the shortcut menu for the solution, and choose Add, Content types for an External Data source.
The first page of the wizard is used to specify the URL of the data service. On the Specify OData Source page, enter the URL of the OData service that you want to connect to. The URL should resemble the following: http://services.odata.org/Northwind/Northwind.svc/.
Choose a name for your OData source, and then choose Next.
A list of data entities that are being exposed by the OData service appears. Make sure that the Create list instances for the selected data entities check box is selected.
Select one or more of the entities, and choose Finish.
The last thing you have to do before deployment is modify the URL in your newly created external content type file.
Open the .ect file in an XML editor.
Modify the ODataServiceMetadataUrl property to point to the URL that allows access through the reverse proxy.
Modify the ODataServiceUrl property with the URL that allows access through the reverse proxy.
For information about how to add an OData-based external content type, see How to: Create an external content type from an OData source in SharePoint 2013.
Deploy the hybrid app
When it is time to deploy your app, you have a couple of choices. You can deploy it directly to a tenancy using F5 deployment, or you can package it using the publishing features of Visual Studio to create an .app file. This file can then be given to the SharePoint Online tenant administrator and uploaded.
For information about deploying apps for SharePoint, see the following:
You can also take the BDCM file created for the external content type and extract that to be used at any level above the app. This is demonstrated in How to: Convert an app-scoped external content type to tenant-scoped.