“The form cannot run the specified query” in InfoPath 2007 Forms Migrated to SharePoint 2010

InfoPath 2007 forms migrated to a SharePoint 2010 site may show this error. It happens when the form contains controls which populate data from a SharePoint list using the following URL in data connection.

http://site/_vti_bin/owssvr.dll?Cmd=Display&List={list_GUID}&XMLDATA=TRUE

The ULS errors being logged for this error would be,

 The form cannot run the specified query. The remote server returned an error: (400) Bad Request.)

A workaround for this problem is to modify the data connection and append “&noredirect=true” to the URL. So the resulting URL would look like

http://site/_vti_bin/owssvr.dll?Cmd=Display&List={list_GUID}&XMLDATA=TRUE&noredirect=true

InfoPath Error: Current configuration settings prohibit embedding username and password in the database connection string

You may see this error when opening browser enabled InfoPath forms published into SharePoint 2010 forms libraries. The reason is, the form may have an associated data connection file (.udcx) which stores external data source connection details such as user name and password and the SharePoint farm is not configured to allow saving external data connection information in data connection files. To get rid of the error you will have to make the following changes in InfoPath Form Services settings.

Navigate to Central Admin > General Application Settings > Configure InfoPath Forms Services

Check the options “Allow embedded SQL authentication” and “Allow user form templates to use authentication information contained in data connection files” under the “Authentication to data sources” section.

Error in InfoPath forms which access SharePoint web services over a secured connection

When an InfoPath web enabled form tries to access a SharePoint web services (usually for getting user profile information, values from custom list etc.) from a web application using a secured connection (SSL), it may show the following error.

You do not have permissions to access a Web service that provides data required for this form to function correctly.

In the ULS log or Windows Event Viewer in the web front end server you will see the following error.

An operation failed because the following certificate has validation errors:\n\nSubject Name: CN=<some text>, OU=<some text>, O=<some text>, L=<some text>, S=<some text>, C=<some text>\nIssuer Name: CN=<some text>, O="<some text>", C=US\nThumbprint: <some text>\n\nErrors:\n\n The root of the certificate chain is not a trusted root authority..

This is because, when you use SSL certificate for your web application URL, the certificate needs to be imported into SharePoint trusted root certificate store (if you are using NTLM). If you are using claims based authentication, you may need to import the certificate you used for token signing. I have explained how you can in export the certificate and import it into SharePoint trusted root certificate store in this article.