As of now, SharePoint Online supports only BCS model with OData (Open Data Protocol) Services. So let us see what this OData and how to create an “External Content Type” using Visual Studio 2012 for SharePoint 2013 Online.
What is OData?
The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (Atom Pub) and JSON to provide access to information from a variety of applications, services, and stores.
My development environment:
- Visual Studio 2012
- Office Tool For VS 2012 OfficeToolsForVS2012RTW.exe
- SharePoint Office 365
Consuming OData Data Sources in SharePoint 2013 Online through Business Connectivity Services(BCS).
1. Launch Visual Studio 2012 and create a new project using apps for SharePoint 2013
2. Enter the name of your app for SharePoint, name of the site where to host the apps and how do you want to host your app.
3. This is the structure of our new project
4. To add an external content type, right-click your project and choose “Add a new item”. You will see a new menu item called “Content Types for an External Data Source..”. Click on it.
5. Time to configuring the “External Data Source”. For demo sake we can use a public OData Service provided by http://tv.telerik.com/services/odata.svc/
6. Select data entities for which you want to generate external content types. Also check “Create list instance for the selected entities” option so that an instance will be created automatically when package is deployed to the site.
7. Looking at the structure we can see that “Content Type” and “List Instance” are added to the project
8. Mark up of the “List Instance” created
<?xml version="1.0" encoding="utf-8"?>
<ListInstance Url="Lists/Videos" Description="Videos" OnQuickLaunch="TRUE" Title="Videos">
<Property Name="LobSystemInstance" Value="TelerikODataDataSouce" />
<Property Name="EntityNamespace" Value="TelerikTvDataServiceDataServiceModels" />
<Property Name="Entity" Value="Videos" />
<Property Name="SpecificFinder" Value="ReadSpecificVideo" />
<Property Name="MetadataCatalogFileName" Value="BDCMetadata.bdcm" />
9. Time to deploy the solution. Right click the project and click on the “Deploy”
10. Browse your site to see the “External List Instance” that is just created by Visual Studio 2012.
11. Click on the List Instance and you will see a page like this
12. View the list of installed apps
13. We can find the newly created “External Content Type” by going to view all contents page of the site.
14. We are done and we can see all items in the List now.
Working with SharePoint 2013 and OData Model is quite easy. I will find some time in the future to make CRUD options with OData as well. Hope you enjoyed reading it. Please leave your comment/views when you find it useful that will help me a lot