Does anyone know if MVC 4 WebApi can (or will) be consumable in power-pivot?
Asked
Active
Viewed 1,778 times
6
-
Web API can provide OData format feeds at this point but I think the heart of this specific question is if Excel PowerPivot will connect to it. The PowerPivot expects some kind of method list available at the Source URL when you setup your feed connection. WCF Data Services provides this OOTB but Web API does not. – Oliver Gray Jan 10 '13 at 14:11
3 Answers
2
Web API itself does not have built-in support for exposing endpoints in the OData format. We are planning on adding OData support via an add-on that will ship in the future.
-
1Any idea how soon this will ship? In the meantime, should WCF Data Services be used? – Shane Castle Aug 31 '12 at 20:50
-
2@ShaneCusson a preview version is available here: http://nuget.org/packages/Microsoft.AspNet.WebApi.OData/0.1.0-alpha-120815. More discussion about dates here: http://aspnetwebstack.codeplex.com/discussions/391903 or here: http://aspnetwebstack.codeplex.com/discussions/359229. – marcind Aug 31 '12 at 22:50
1
I think if you expose an IQueryable<T>
, it exposes it as a OData feed.
I found this.
http://codebetter.com/johnvpetersen/2012/03/22/bringing-odata-to-your-webapi-just-use-iqueryable/

Daniel A. White
- 187,200
- 47
- 362
- 445
-
1My understanding is that exposing an IQueriable interface through a WebApi will enable you to use the OData URL convention's for query composition, but that wont necessarily enable PowerPivot – cmilhench May 31 '12 at 14:15
-
0
It works fine in Excel 2013 as a data source. In earlier versions e.g. Excel 2010 there is a workaround described here: http://aspnetwebstack.codeplex.com/workitem/820
Basically the default output is JSON and Excel didn't send the proper Accept header to receive XML. So you have to add this to your Web API's start-up Register function:
IList<ODataMediaTypeFormatter> odataFormatters
= ODataMediaTypeFormatters.Create();
var jsonFormatter = odataFormatters
.First(f => f.SupportedMediaTypes
.Contains(MediaTypeHeaderValue.Parse("application/json")));
odataFormatters.Remove(jsonFormatter);
odataFormatters.Add(jsonFormatter);
config.Formatters.InsertRange(0, odataFormatters);

SteveC
- 15,808
- 23
- 102
- 173

David d C e Freitas
- 7,481
- 4
- 58
- 67