First published on TECHNET on Aug 02, 2018
This post is a contribution from Jing Wang, an engineer with the SharePoint Developer Support team
Recently I worked with two customers who wanted to show their external data on SharePoint Online web sites, one from on-premise SQL Database and one from their secured internal data source.
They did not want to migrate their SQL Database to SQL Azure.
We researched for few possible options and chose the most feasible, easy to implement and secure solution - "Create custom OData WCF service accessing external data source and generate BDC external content type through SharePoint hosted Add-in.". Note this solution will also work for SharePoint On Premises but is especially suitable for SharePoint Online as we have some constraints on the kind of customization that can be done in SharePoint Online.
Here is the high level overview of the steps involved:
Step I - Create an Internet-addressable ASP.NET Windows Communication Foundation (WCF) Data Service to expose the SQL database.
Note: This article covers the steps before Visual Studio 2017.
If you use VS2017, it does not come with WCF Data Service by default, you need to install WCF Data Services Template for Visual Studio 2017: https://marketplace.visualstudio.com/items?itemName=CONWID.WcfDataServiceTemplateExtension#overview...
WCF team also recommend to add a beta version of the WCF DataServices EntityProvider to your project: https://www.nuget.org/packages/Microsoft.OData.EntityFrameworkProvider/
Once the two things are installed, you can add WCF Data Service to the Project after you create ADO.NET Entity Data Model following the HowTo article above:
For Data Sources other than SQL Database, please refer to this article:
How to: Create a Data Service Using the Reflection Provider (WCF Data Services) -
Step II - Generate a Business Connectivity Services (BCS) external content type connecting to the OData WCF service above with SharePoint Hosted Add-in and extract the model file out:
If you don’t want to expose your OData data service anonymously, you need to continue with Step III and Step IV, otherwise, skip to Step V directly.
Step III - Create Target Application in SharePoint Central Admin site –Secure Store Service.
Step IV- Edit BDC model to use the Secure Store Target Application:
Highlighted lines are the ones you need to manually put in the model file.
Step V - Import the External content type’s BDC model file to SPO BDC Service Application
To import the model file using SharePoint Central Administration pages
Step VI - Create External List from the External Content Type created above.
Here is a screen shot of the External List, showing the Microsoft sample AdventureWorks database – productInventory list:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.