HateBear
HateBear

Reputation: 91

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

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.

Upvotes: 7

Views: 8242

Answers (2)

Kevin .NET
Kevin .NET

Reputation: 473

Same error (400 bad request) cost me much time. My working solution is adding NoRedirect=true at the end of my URL:

http://server/qa/_vti_bin/owssvr.dll?Cmd=Display&List={***E885}&XMLDATA=TRUE&noredirect=true

Ref: https://sajiviswam.wordpress.com/2012/03/20/the-form-cannot-run-the-specified-query-in-infopath-2007-forms-migrated-to-sharepoint-2010/#comment-564

Upvotes: 0

Eric Herlitz
Eric Herlitz

Reputation: 26307

You must add ?NoRedirect=true when downloading the file

file.xml?NoRedirect=true

Upvotes: 1

Related Questions