locked
Odata Support for Custom WCF SharePoint Service RRS feed

  • Question

  • Hi,

    I've developed a custom SharePoint service (in ISAPI which is accessible via _vti_bin).

    Previously this web service wasn't implementing OData (only REST). I changed the factory to MultipleBaseAddressDataServiceHostFactory and the return type of my get methods to IQueryable<T>.

    That usually does the trick with WebAPI (the IQueryable thing) but I guess that's because something in WebAPI's stack implements the OData Provider for my IQueryables and intercepts the requests.

    I thought SharePoint 2013 could do the same but obviously it is not the case.

    I think I'm missing something but I don't know exactly what.

    Last precision my data doesn't come from a SQL database so I don't have and entity framework data context and therefore I can't use WCF Data Services.

    Any idea of what I'm missing here?

    Thanks for your help!


    Cya

    Tuesday, August 19, 2014 9:07 PM

Answers

  • Hi,

    I found the code solution corresponding to #1. http://www.silver-it.com/node/102

    I Upgraded it, faked the datasource as objects used in this sample are deprecated and got it to work.

    Now that I have a working POC I'll try to adapt my real service and get it to work.

    I'll let you know if I come across any other issue.


    Cya

    Monday, August 25, 2014 2:25 PM

All replies

  • Hi,

    If you want to create a custom OData Service, the links below would be helpful:

    https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/Building-and-consuming-a-custom-oData-service-for-SharePoint-2010.aspx

    http://jbarkes.blogspot.com/2014/04/sharepoint-2013-create-custom-wcf-rest.html

    http://www.codeproject.com/Articles/393623/OData-Services      

    Thanks

    Patrick Liang

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com



    Patrick Liang
    TechNet Community Support

    Thursday, August 21, 2014 7:50 AM
  • Hi,

    Thanks for pointing out these resources, I already found the two last ones.

    Basically my existing service was done the same way as the second one. This works fine only it doesn't provide support for odata.

    #1 and 3 are a little outdated, System.Data dll's have been replaced by Microsoft.Data. I tried to implement a POC of #1 in SharePoint 2013 (without the caching thing because I don't need it) I can't get it to work. It says it can't locate the class for the WS. I bet it's a referencing issue or something but since it doesn't seem to write in SharePoint logs or events logs I can't get any detail.

    #3 is outside of SharePoint, I think it would work fine in that scenario but I'm pretty sure I would hit the same issue trying to bundle it in a SharePoint solution.

    Any idea? Thanks for your help!


    Cya

    Friday, August 22, 2014 3:32 PM
  • Hi,

    I found the code solution corresponding to #1. http://www.silver-it.com/node/102

    I Upgraded it, faked the datasource as objects used in this sample are deprecated and got it to work.

    Now that I have a working POC I'll try to adapt my real service and get it to work.

    I'll let you know if I come across any other issue.


    Cya

    Monday, August 25, 2014 2:25 PM