SharePoint 2013 - InfoPath form using REST API and cannot get the data

HateBear picture HateBear · Mar 24, 2014 · Viewed 7.4k times · Source

Environment: SharePoint 2013 Online & InfoPath form 2013

I'm try to make a data collection using REST API and using a button to trigger the action.

When I preview the form & press the button first time, I get the error as below

The query cannot be run for the following DataObject: Document in Dev InfoPath cannot run the specified query.
The file is not a valid XML file.
Some form data cannot be retrieved bacause InfoPath is operating offline mode. Form elements, such as drop-down lists, may be blank. Ensure that you have network connectivity and that InfoPath is online mode.


When I Click the button second time , it can be receive the data.

When I publish the form to SharePoint, I will get the error every time when i press the button

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


Any Idea??
I can get the correct data when I directly access the REST API link.

Answer

Eric Herlitz picture Eric Herlitz · Mar 24, 2014

You must add ?NoRedirect=true when downloading the file

file.xml?NoRedirect=true