Skip to main content

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.

 

 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.

Thoughts on “Consuming OData sources in SharePoint 2013 App step by step”

  1. Hi Parshava,
    I tried giving ODATA service as you specified , with Northwind.svc, it works, but with our ODATA service URL. It specifies OData is invalid. But the same URL shows data in Browser.
    After searching the error on net, found that ODATA must be having large data and so it cannot move further from Addition of ODATA URL in Specify Odata wizard.
    Can you tell me the reason why and whats the other approach to achieve the Dynamics CRM 2013 OData data into the sharepoint Lists in SharePoint 2013 on Primises.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Parshva Vora

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

Follow Us
TwitterLinkedinFacebookYoutubeInstagram