Forcing InfoPath forms to load in web browser view - SharePoint

Scenario and solution:
You have a page that containd web part views into your forms library (that contains forms that can be filled out in a browser). The problem here is that if you or your client has InfoPath installed on their computer, everytime they click the link the form will try and open in their InfoPath client; prompting them for authentication.
If the client goes to the forms library itself and clicks on a InfoPath form the form opens in the browser no problem, why? The answer is in the url, try this:
  • Go to the forms libray and click on a form, check the URL; it should look something like this: "http://site.example.com/subsite/_layouts/FormServer.aspx?XmlLocation=/subsite/formLibrary/formName.xml&Source=http%3A%2F%2Fsite%2Eexample%2Ecom%2Fsubsite%2FformLibrary%2FForms%2FMyView%2Easpx&DefaultItemOpen=1
  • No go the web part and click the same form, check the URL (in the browser status bar): http://site.example.com/subsite/formLibrary/formName.xml
  • Note that the URL is completely different which is why I think the form does not want to open in the web browser view.
Now, to fix the URL in the web part we are going to need to convert that web part to a data view web part through sharepoint designer:
  • Open one of your forms from the form library and copy the URL into NotePad.
  • Open the offending page containing the web part in sharepoint designer.
  • Go to design view, right click the web part and select convert to xslt data view.
  • Select the ">" next to the data field that you want displayed as the link to the file and then select the option to format the text as a hyperlink.
  • In the new dialog box, in the location text box paste the URL from NotePad.
  • Replace the following text: "XmlLocation=/subsite/formLibrary/formName.xml" in the location text box with "XmlLocation={@FileRef}" this tag indicated the full URL to the form.
  • Save
Open the web part page and click the link in the web part: the form now opens in a web browser!

Comments

Popular posts from this blog

SharePoint 2016 and 2019 Ports

PsConfig step by step /Configuration Wizard. “Upgrade Available” vs “Upgrade required”

Unlock the SharePoint site using Powershell command