MVC 4 WebApi with PowerPivot?

Does anyone know if MVC 4 WebApi (or will) be consumed in power-pivot mode?

+6
source share
3 answers

The web API itself does not have built-in support for exposing endpoints in OData format. We plan to add OData support through an add-on that will be sent in the future.

+2
source

I think if you expose IQueryable<T> , it exposes it as an OData feed.

I found this.

http://codebetter.com/johnvpetersen/2012/03/22/bringing-odata-to-your-webapi-just-use-iqueryable/

+1
source

It works great in Excel 2013 as a data source. In earlier versions, for example. Excel 2010 there is a workaround described here: http://aspnetwebstack.codeplex.com/workitem/820

Basically, the default output is JSON, and Excel did not send the proper Accept header to receive the XML. Therefore, you should add this to your Web API login 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); 
0
source

Source: https://habr.com/ru/post/917097/


All Articles