Posts

Showing posts from October, 2014

SharePoint 2013 Online and ASP.NET Web API using JSONP

Consider a scenario where you have to display data or make decisions on a SharePoint 2013 page based on the data that exists in a database. Here is what you can do: Abstract: 1. Create an Empty ASP.NET Web API project. 2. Enable the project for JSONP format 3. Add the Controller, Model, the business and data access logic to the service 4. Deploy the Service 5. Add script to SharePoint 2013 page Details: 1. Create an Empty ASP.NET Web API project. This is fairly simple step, all you need is MVC4 or above and .NET Framework 4.5. Using Visual Studio 2012/2013, Add new project, select an empty project and check the Web API box and click OK. 2. Enable the project for JSONP format: - Open package manager in visual studio (Tools>NuGet Package Manager > Package Manager Console and run the following command, it will add the required dlls to your project: Install-Package WebApiContrib.Formatting.Jsonp - In App_Start folder of the project, create a new class: