none
Sharepoint 365, Infopath 2013 and REST connections - Works in Preview mode, not in browser

    Question

  • Hello all, hoping someone can help me here. 

    I've found several solutions online but none seem to be working. Here's the problem: 

    We have a custom, standard Odata API setup as a Rest Service on an external domain (different from the one our O365 Sharepoint site is running on) 

    I'm able to query and use the REST service in EXCEL just fine, so i know that it is standard and working as an OData REST service is expected to work by applications. We're also forcing it to return straight xml, not JSON

    So we have two infopath forms on our SP365 site. One is a browser-enabled form (because I heard that could solve the issue, it didn't) and other is made from the Form Options on a SharePoint list. 

    For both forms, I created a rule when a field changes to use the ID set in that field to query the rest service, filtered on that ID. Example query in that case: concat("http://ourapi.externaldomain.com/odata/Search_ProjectDetailsIndexs?$filter=ProjectID eq (guid'", ProjectIDField, "')")

    There are then several other actions to set the Infopath Form fields to values pulled as a result of the query (and of course an action to requery the data after the URL has been changed) 

    In Preview mode? This works fine on both forms

    When we actually publish the form and try it in the browser, it does not work and returns the following error: 

    XML data that is required for this form to function correctly cannot be found.

    An entry has been added to the Windows event log of the server.
    Log ID:5566

    Correlation ID:7db1d39d-a02f-3000-9f42-2576d88db316

    I'm still waiting to hear back from our SharePoint Team on the log details...but have any of you encountered this situation before? It's so damn frustrating as it seems like this should not be a very complicated thing to do. 

    Any help is appreciated. Thanks so much all!

    Friday, February 10, 2017 4:48 PM

Answers

  • Hi Keledron,

    A workaround is that call the external web service using Jquery in the list form rather than using InfoParth, this way will avoid loopback corss domain limitation in Office 365 and can also work in web browser.

    SharePoint call OData Web Service using Jquery

    Thanks

    Best Regards


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

    Tuesday, February 14, 2017 8:14 AM

All replies

  • Hi Keledron,

    Call rest api in InfoPath form and view in web browser, it needs loopback supported. However, loopback is only supported in SharePoint Sever On-Premise and is prevented in SharePoint Online. 

    As the cause above, SharePoint Online infopath will not trigger REST API for browser.

    Here are some similiar threads for your reference:

    Infopath 2013 Error: XML data that is required for this form to function correctly cannot be found

    Using REST API in browser enabled InfoPath forms

    More information:

    InfoPath browser forms cannot access REST web service over SSL

    Thanks

    Best Regards


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

    Monday, February 13, 2017 10:50 AM
  • So there is no way to get InfoPath 2013 and REST calls to work in SharePoint 365?

    I've seen videos of people calling Netflix's REST API in O365 making a search on the movie database and it's working correctly.

    What method would I need to take in order to get this working? Even if it's a method where our users need InfoPath installed, that's okay. I just need to know what we need to do in order to get this working.

    Thanks

    Monday, February 13, 2017 12:22 PM
  • Hi Keledron,

    A workaround is that call the external web service using Jquery in the list form rather than using InfoParth, this way will avoid loopback corss domain limitation in Office 365 and can also work in web browser.

    SharePoint call OData Web Service using Jquery

    Thanks

    Best Regards


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

    Tuesday, February 14, 2017 8:14 AM
  • Hi Jerry,

    As it turns out we had to do two things: One was set the form to Fully Trusted and then have it digitally signed, and then create javascript code to call the service behind the scenes as a sort of "middle man" between sharepoint and our API.

    A similar approach is going to have to be taken with another API we have running in API Management, due to the requirement of an API Key in the HTTP header (which as far as we could tell can't be edited in InfoPath out of the box).

    Perhaps it's time to start looking into Power Apps that we keep hearing so much about. Thanks!

    Friday, February 17, 2017 12:37 PM