InfoPath 2013 Forms on Office365 with External REST DataSources
I’m building a reasonably complex form with InfoPath 2013 in which I need to look up data for some dropdowns from several external REST Web Services. The REST services are available publicly and anonymously, so authentication isn’t any issue.
For example, say I have a field on the form which displays values for Category in a dropdown. The form is housed on the domain https://mydomain.sharepoint.com at Office365 [in a subsite, but that shouldn’t matter] and the REST service which provides the available values for Category is housed on http://www.someotherdomain.com. The latter domain is fully in our control, but it’s non-Microsoft.
I needed to be able to open the form in the browser for the users, but when I tried to do so, I got an error like this:
Warning
An error occurred querying a data source.
Click OK to resume filling out the form. You may want to check your form data for errors.A query to retrieve form data cannot be completed because this action would violate cross-domain restrictions.If this form template is published to a SharePoint document library, cross-domain access for user form templates must be enabled under InfoPath Forms Services in SharePoint Central Administration, and the data connection settings must be stored in a UDC file in a data connection library in the same site collection.
If this is an administrator-approved form template, the security level of the form must be set to full trust, or the data connection settings must be stored in a UDC file by using the Manage data connection files option under InfoPath Forms Services in SharePoint Central Administration.
An entry has been added to the Windows event log of the server.
Log ID:6932Correlation ID:c3e8619c-8c52-407e-34ca-9d5f1dc4564d
I understand all about cross-browser scripting, but this is SharePoint, which always makes things more complicated. Since we don’t have access to Central Administration, what was the right solution? Everything here is fully trusted, and the REST services are read only. There had to be a way.
I posted this as a question on the MSDN Forums at SharePoint forums > SharePoint 2013 – Using SharePoint Designer, InfoPath and Other Customizations. There were some good suggestions, but I finally stumbled on what seems to be the best fix.
When you look at your existing data connections, you can choose a data connection and Convert to Connection File…. You must have a Data Connection library in your Site Collection in which to store the UDCX files.
So, the steps seem to be:
- Create a Data Connection Library in your Site Collection (I added it in the root of mine)
- In the InfoPath ribbon, go to Data, then Data Connections. Your existing data connections should be listed.
- Choose the data connection which is hosted on a different domain.
- Clink the Convert to Connection File… button
- In the location selector, specify the path to the Data Connection Library you created above. Mine is at https://tenantname.sharepoint.com/sites/Projects/DataConnections/ and append the name for the connection file, such as Categories.udcx
- Leave the Relative to site collection (recommended) radio button selected.
- Click OK
Once the operation completes, you’ll have a new item in your Data Connection Library, and the data connection should work in a browser-based form. In essence, what you’ve accomplished above is to tell SharePoint that the connection you would like to use is trusted.
All this without access to Central Administration!
Nice trick. Too bad it’s needed, but good to know if I ever do!
Tom:
It took me a good long time to figure out. It’s probably one of those things where I wasn’t searching on the right words, but if you don’t know the right words…
M.
Should have just asked me, I would have fixed ya up. I always use data connection libraries for all connections. Cross domain call support is also configurable through InfoPath Forms Services administration and can be turned on or off.
It’s one of those things where if you know who to ask, you barely need to ask. ;+) I took to the Twitters, but maybe you were, I don’t know, working that day?
This is Office365, so no Central Admin with which to do the heavy stuff.
M.
It’s been a long time since this was posted – hoping for some help.
This works if the REST connection is NOT to SPO SharePoint.
Do you have a work around for the no double hop setting in SPO?
I’ve tried the UDCX method but no luck.
My form does not violate cross domain issues
Thanks