Microsoft Collaboration, CTO viewpoint, and New York

The blog for Office 365, Power Apps, Flow, SharePoint, cloud, ….. plus a little NYC

You are currently browsing the infoPath category.

Mystery InfoPath Error – XML has been modified

I had a wacky error the other day on saved InfoPath forms. This prevented edits and approvals.

-Is invalid.  It may refer to a nonexistent file or folder

The cause of this error is because the SharePoint Designer workflow modified the item, with a published workflow saved with a Forms authentication ID, rather than an AD ID.

After a lot of searching, this error can be easier prevented with publishing workflows with the AD ID.

So what do you do with existing form submissions? Download the InfoPath XML file, delete the file in the library and re upload it.

Instructions on how to publish an InfoPath form with anonymous access

 

Given the inbuilt SharePoint restrictions on submitting an InfoPath form with anonymous access, this document outlines the steps to change the InfoPath form and publish it to a SharePoint environment, to allow an anonymous access.

Steps:

Make change to the InfoPath form

 

Also in this Youtube video

http://www.youtube.com/watch?v=ZMvYQ9P1loU

 

  1. Change the submission code in InfoPath to :
    1. Go to Data tab -> Data Connections

       

       

    2. Remove the existing Main Submit connection. Then click on Add button.
    3. On Data connection wizard -> Select Submit Data option and click on next button

    4. Select “To a document library on SharePoint site” option and click on next button

       

    5. Specify URL of Document Library and click on “fx” button and paste below formula and click on verify formula button and select “Allow overwrite if file exists” option and click on next button.

    concat(“Form – “, my:UserLastName, ” “, my:UserFirstName, ” – “, xdDate:Now())

    1. Give the name of data connection and click on finish button. Note: Verify that “Set as default submit connection option is selected”.

       

    2. On Data Connections dialog, select the submit data connection that you created in above steps and click on “Convert to Connection File” button.

       

    3. On Convert Data Connection dialog specify valid URL of Data Connections library (e.g. http://<server:port>/DataConnections/ContactUsDataFile.udcx) and select “Centrally managed connection library” and click on OK button.

      If the data connection library does not exist in the SharePoint site in which you are publishing the InfoPath Form, then create a Data Connection library in that SharePoint Site. Refer section “To create a SharePoint Data Connection Library” in this link http://msdn.microsoft.com/en-us/library/ms772101%28v=office.14%29.aspx for steps to create data connection library.

       

      Note: We have to create data connection library for temporarily saving the Data Connection file. After the data connection is converted and user downloads that data connection file (.udcx file) then there is no need of this library. As we will be storing the data connections in Central Administration.

       

       

       

    4. Now go to File -> Form Options

       

       

       

    5. On Form Options dialog -> on Programming category :
      1. Click on “Remove Code” button if it is enabled.
      2. Select “C#” as Form template code language
      3. Specify appropriate location for the code
      4. Click on OK button

    6. Right click on Submit button and click on “Button Properties”

       

    7. Verify whether “Rules and Custom Code” option if selected for the action, if not please select that option and click on Edit Form Code button.

       

    8. Once visual studio opens, add reference of Microsoft.SharePoint.dll to the visual studio project
      1. Right click on “References” option in Project explorer and click on “Add Reference”.

      2. On Add Reference dialog, click on browse tab and enter following location in filename textbox and click on OK button.

        C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\ISAPI\ Microsoft.SharePoint.dll

         

    9. Now add following code to using section at the top of “formcode.cs” file

      using Microsoft.SharePoint;

    10. Now paste the following code under “SubmitButton_Clicked” method

      SPSecurity.RunWithElevatedPrivileges(delegate()

    {


    this.Submit();

    });

            

    1. Now save the file and build the project and close the project. Note: The project should build successfully. To build the project, go to Build menu in visual studio and build the project.

     

    NOTE: User should go to Build menu in visual studio to build the project

    1. Now you can publish the form.

Publish the form to SharePoint Central Admin

 

Publish InfoPath Form to SharePoint 2010

Follow the instructions in below link to publish the InfoPath form from Central Administration:

http://msdn.microsoft.com/en-us/library/ms772405%28v=office.14%29.aspx

Once the form is uploaded and activated to relevant site collection, then you can add Content Type

Upload Data Connection to SharePoint Central Admin

 

Also in this Youtube video

http://www.youtube.com/watch?v=8dXtSK5wVDY

Note: this is for 2007, but the steps are the same for 2010

 

  1. Download the data connection (ContactUsDataFile.udcx) file from the SharePoint site where you had saved it in above step (h).
  2. Open the ContactUsDataFile.udcx file in notepad and specify the URL of your Forms Library inside the <udc:FolderName AllowOverwrite=”1″> tag.

    e.g. <udc:FolderName AllowOverwrite=”1″><FULL URL to forms library in SharePoint site></udc:FolderName>

     

     

  3. Now to upload the data connection file to Central Administration, follow the instructions under “To upload a data connection file by using Central Administration” header on this link: http://technet.microsoft.com/en-us/library/ff621104%28v=office.14%29.aspx
  4. Apply a Content Type to the form to the library.

InfoPath forms on the cheap….Not really.

I was speaking to a client who has MS Office professional rolled out to its organization and this Office version has the InfoPath client deployed. They were strongly under the impression that they didn’t need the SharePoint Enterprise license, because the forms part had been paid for with their Office purchase.

This is not correct, as once the form is submitted to the server, the SharePoint Enterprise bit needs to take action and capture the submitted form.

Oh the joys of MS licensing.

InfoPath forms in lists and libraries

I’ve been working with this recently and have a few comments and tips.

Yes custom lists, can be converted into InfoPath forms.    This is ideal, when the requirements change and you think to yourself……If I’d known how complex the form was at the beginning then I’d have started with InfoPath.

There are  few things to note with InfoPath forms in lists:

-It’s quick. To Start.  Just use the button on the Ribbon

-No repeating tables-fields are saved directly in lists.  Each field turns into a column

-No code

-Can’t use an XML schema

-The Submit is straight into the library.

If you have a lot of data in the list, you may get a publishing error such as :

INFOPATH: SOAP error on publishing list form

There is some confusion on how to fix this… eg:

It is easy to resolve,  by downloading the list items into Access, deleting the items and then then reimporting them..   This is easier than you think.

One caveat to this, is that the ID number increasing and does not reset when you delete the items

How to: Use Query Parameters to Invoke Browser-Enabled InfoPath Forms

Link

Good article on MSDN on kicking off Infopath forms.

There are four methods for invoking an InfoPath form or a browser-based version of the form on a server that is running InfoPath Forms Services. These methods consist of URLs that reference a form template file (.xsn), URLs that reference a form file (.xml) based on a form template, URLs that reference the built-in FormServer.aspx Web page, and those that contain a reference to a custom page that contains the XmlFormView control. The first three kinds of URL support using query parameters to control aspects of the resulting form that includes whether it will be opened in the InfoPath Filler or rendered in the browser, the location where the form will be saved, and the Web page that the user will be directed to when they close the form.

Click column

In the previous post I explained how to open an InfoPath form in the iframes of SharePoint.  This post will explain how to open an InfoPath form in an iframe of SharePoint.

Steps

Firstly there needs to be code in the column that will target a saved form

Create a column in a view:

=CONCATENATE(“<DIV><a href=’http://<servername>/<Site>/pages/EditInfopath.aspx?formname=/<Site>/Library/”,Title,”‘>”,Title,”</a></DIV>”)

EditinfoPage– To open up the infopath form with the query string:

<iframe src=”” width=99% scrolling=no frameborder=0 marginwidth=0 marginheight=0 height=1000></iframe>

Add this in a content editor web part

<script>

<!–

function getArgs() {

var args = new Object();

var query = location.search.substring(1);

var pairs = query.split(“&”);

for(var i = 0; i < pairs.length; i++) {

var pos = pairs[i].indexOf(‘=’);

if (pos == -1) continue;

var argname = pairs[i].substring(0,pos);

var value = pairs[i].substring(pos+1);

args[argname] = unescape(value);

}

return args;

}

var args = getArgs();

if (args.formname) formname = args.formname;

 

var sourceURL = “http://<servername>/<Site>/default.aspx“;

 

var iframe = document.getElementById(“MyFrame”);

iframe.src = “‘http://<servername>/<Site>/_layouts/FormServer.aspx?XmlLocation=” + formname + “&Source=” + sourceURL + “&DefaultItemOpen=1”;

 

–>

</script>

How to redirect to a page when an InfoPath form is submitted.

There’s no way to do this in InfoPath, but a work around is the url.

If you look at the URL of a form, the &Source, part is a redirect to another location.  Put any URL after the  source and the page will be redirected.

&Source=https%3A%2F%2Fporta%2FSiteDirectory%2FLists%2FProject%2520Request%2520Form%2FAllItems%2Easpx

InfoPath 2007

InfoPath 2007 top tips

One drawback with InfoPath is that the page takes up the whole screen. A way to get round this is to have the InfoPath page open in a page viewer web part. By doing this, the top navigation and quick launch is still visible.

To break out of the of page frame set is a challenge, as HTML links can’t be put on the the infopath form page.

This is the first of a couple of posts on InfoPath and techniques to get round some of the inbuilt functionality.

InfoPath…..Times out with large amounts of data.

Recently I’ve been building a PO Request form in a browser InfoPath, that needs to bring in large amounts of data from Dynamics GP (Great Plains) on to the form. This data includes vendor codes and vendor names. The problems with data connections with SQL is that these kind of error will occur:

Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer might become unresponsive.

This is a limitation of the data connections in Infopath. There is because the form is trying to grab 5,000 records at once and there is no way to filter on the records before you bring them back.

I got round this problem by using a 3rd party product :Web Services Solution Pack (WSSP) by Qdabra

Another nice feature of the product is that if you have the need for dynamic lookup, with one value based on another field, then another, it can make these calls to the database.

Also to improve performance

I’m not a huge fan of 3rd party products, but this one looks like the Bamboo Solutions type for InfoPath forms.

better error checking on an infopath form

On a web based InfoPath form, often the errors are of vague such as, ‘Access denied’ or ‘error’

If you are ever in this situation, change the setting on the document library to open in an InfoPath client. When this happens the error messages are more detailed, such as ‘Access Denied with ID- Sys Admin’