Cloud

Consuming OData sources in SharePoint 2013 App step by step

SharePoint 2013  has an out-of-box supports for connecting to OData sources using BCS. You no longer are required to write .Net assembly connector to talk to external OData sources.

1. Open Visual Studio 2012 and create a new SharePoint 2013 App project. This project template is available after installing office developer tools for Visual Studio 2012.

Create App


Select App Settings

2. Choose a name for the app and type in the target URL where you like to deploy the App. Also choose the appropriate hosting option from the drop-down list. For on promise deployment select “SharePoint-Hosted”. You can change the URL later by changing “Site URL” property of the App in Visual Studio.

3.Add an external content type as shown in the snapshot below. It will launch a configuration wizard. Type in OData source URL you wish to connect to and assign it an appropriate name. For this demo purpose, I am using publicly available OData source NorthWind.

Microsoft - The Essential Guide to Microsoft Teams End-User Engagement
The Essential Guide to Microsoft Teams End-User Engagement

We take you through 10 best practices, considerations, and suggestions that can enrich your Microsoft Teams deployment and ensure both end-user adoption and engagement.

Get the Guide

 

 4. Select the entities you would like to import. Select only entities that you need for the app otherwise not only App will end up with inflated model but also all data associated with each entity will be brought into external lists.Hit finish. At this point, Visual Studio has created a model under “External Content Types” for you.  Feature is also updated to have new modules.

 
 

5.Expand “NorthWind” and you should see customer.ect. This is the BCS model. It doesn’t have a “.bdcm” extension like its predecessor. However it doesn’t alter its behavior as the model is still defined with XML. If you open the .ect file with ordinary XML editor, you can observe similarity in schema.

Customer BDC model representing OData entity

 

6. Deploy the App. And browse to the http://sp2013/ListCustomers/Lists/Customer({BaseTargetUrl}/{AppName}/Lists/{EntityName}) . You should see imported customer data in external list.


 
 
 
 
 
 
 
 
 
 
 
 
7. You can program against this data like any other external list.

About the Author

Parshva Vora is a Technical Architect at Perficient since 2009 and has extensive experience building enterprise solutions, portals and software products using Microsoft technologies.

More from this Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up