How to Create External Content Type Using OData Source in SharePoint 2013

Introduction

External Content Types define the data stored in the external system. External Lists and external data columns are created using BCS external content types that will behave as a bridge between SharePoint and an external data source to expose the external data in SharePoint 2013. In SharePoint 2013 using Business Data Connectivity Services you will be able to connect to the OData sources such as a database by browsing to the constructed URL. In this article you will see how to create an External Content Type using OData source in SharePoint 2013.

Create External Content Type using OData source

  1. Open Visual Studio 2012 (Run as administrator).
  2. Click on the File menu item and then click on "New".
  3. Click on "Project...".



  4. Select “App for SharePoint 2013” from the installed templates. Enter the Name for the project and then click on "OK".



  5. Specify the URL and select “SharePoint-hosted” from the drop down. Click on "Finish".



  6. In the Solution Explorer, right-click on the project and then click on "Add", "Content types for External Data source".
  7. Enter the OData service URL (http://services.odata.org/Northwind/Northwind.svc) and enter the name for the data source. Click on "Next".



  8. Select the data entities for which you want to generate external content types and select “Create list instances for the selected data entities (except Service Operations)”. Click on "Finish".



  9. In the Solution Explorer, you could see a new folder called “External Content Types” has been created with the following files as shown below.


Modify AppManifest.xml file

To make the list (we selected “Create list instances for the selected data entities” so a list will be created to display the contents) as the starting page of the app to modify the AppManifest.xml file.

  1. In the Solution Explorer, open the AppManifest.xml file.
  2. Update the Start Page value with "~appWebUrl/Lists/Employees".

Deploy the project

Hit F5 to deploy the project. Click on the app that will be redirected to the list to display the contents from the OData source.

Summary

Thus in this article you saw how to create an External Content Type using OData source in SharePoint 2013.