Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

July, 2010

  • Microsoft InfoPath 2010

    Tips and Tricks for Making Form Filling Faster


    The less time it takes to fill out your forms, the more time your users can spend on other tasks. Also, odds go up that form fillers will complete forms when they take less time to fill out. This blog post will give you a few tips for speeding up form filling and improving accuracy so your forms are completed faster.

    In this post we will cover

    1. Using defaults
    2. Using contextual defaults for bringing in the current day and user

    Setting up default values

    For questions where one answer is much more common than others, it can be useful to set up default starting values.  The value you choose will appear when the form is opened, but the form filler is still able to change it.

    You can set default values by selecting the control and clicking on the properties pane, and then choosing “Default Value”.

    Let’s say I had a sailboat rental form, and when boats are rented employees need to fill out who checked out the boat, when it was checked out, what type of boat it was, the boat #, and customer information.


    Because the sailboat rental place has mostly 24 foot boats, we can set the default Size to be 24 feet.   Now employees won’t have to fill this field out most of the time. To set a default value, select the control (the boat size dropdown), choose the Properties tab, and select Default Value. Type the default value in the box provided. You can set the defaults for text boxes, combo boxes, check boxes and many other controls this way.


    Contextual values

    When a boat is being checked out, we need to log the person who checked it out and the date. Most commonly, boats are checked out for today’s date. We want to set the default value of “checked out by” date to be today’s date.

    To set the checked out date to today, select the date control, go to the properties tab, and choose “default value”. Choose the function builder at the right .

    Choose the “Insert Function” button and pick the now() function from the Date and Time Category. Click “OK” until you return to the form.  Now, when users open the form today’s date will be automatically filled in.
    When using today() or now(), the form will update the date when you re-open it unless you uncheck the “Refresh value when formula is recalculated”. Make sure to uncheck this box.


    today() vs now()

    today() and now() can both be used to set the default value of a date picker. However, the type of form you have can affect which one you use.

         - Use today() when you have a date-only field.

         - Use now() when your field requires a date and time.

    In general, when using a SharePoint list form, use now(). When using a form library or filler-only form, use today(), unless you have changed the data format of the date field to date and time.


    Setting up the default user

    Setting the default value of the Person/Group picker is done through the fields task pane. Show the fields task pane by selecting “Show Fields” on the data tab and expand your Person/Group picker field (in my case, outBy). Click “Show advanced view” to see the detailed view. Right-click on the AccountId and choose properties.


    Under default value, choose the function builder  and type userName().
    Again, make sure that “Refresh value when formula is recalculated” is unchecked, so that this rule is only run once and not every time the form is opened. Click Ok.


    Repeat this process with the DisplayName (optional) to get the best experience. Now the people picker will default to the person who opens the form.
    When we load the form, the date, boat type, and checked out by fields are already filled out. With half of the fields completed, it will take employees less time to check out boats.


    Hopefully, these tips will help you set good defaults and your users will spend less time filling out forms!

    Kate Everitt

  • Microsoft InfoPath 2010

    Using Relative URLs with the ServerInfo Class in InfoPath 2010


    Hi, my name is Jill Anderson and I am a tester on the InfoPath team. In this post, I would like to introduce you to the one of the newest members of the InfoPath Object Model, the "ServerInfo" class.  For InfoPath forms published to a SharePoint server, the members of this class give you context about that particular site. Documentation about this new class can be found at:

    In this short video demo, I show you how you can use the members of this class to enable your form to submit data using a relative URL.  This enables you to package a Site Collection as a WSP and move it to a new server.  With these changes, the submit data connection moves to the new server as well.

    Initial Setup:

    To make sure that my form template was correctly associated with my SharePoint Form Library both before and after the Site Collection Migration, I published it as a Content Type ( ). The ability to publish a Sandboxed Solution as a Content Type is a new feature for Office 2010.

    Afterwards, I associated this content type with the correct SharePoint Form Library on the SharePoint Server. The steps to do this are as follows: 

    1. Create a new "Form Library"
    2. Open the newly created "Form Library"
    3. Open the "Library Settings" located under the "Library" Tab on the Ribbon
    4. Open "Advanced Settings" and set "Allow management of content types?" to "yes".
    5. Under "Content Types" select "Add from existing content types"
    6. Add the content type you published to the SharePoint server.

    Sample Code:

    This is the code I used to relativize the submit to the SharePoint site.

    /// <summary>
            /// Submits the form to the SubmittedTimeCards form library on SharePoint and calls a function to update the Vacation 
            /// and Sick Balance for the employee.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">Provides data for the Microsoft.Office.InfoPath.FormEvents.Loading event.</param>
            public void FormEvents_Submit(object sender, SubmitEventArgs e)
                FileSubmitConnection fileSubmit = (FileSubmitConnection)this.DataConnections["SharePoint Library Submit"];
                // Refreshing the Total number of hours and total pay for this given form.
                // Update the new Sick leave and Vacation Balance.
                // Relative the SharePoint Submit location to current SharePoint site.
                fileSubmit.FolderUrl = this.ServerInfo.SharePointSiteUrl.ToString() + "SubmittedTimeCards/";
                // If the submit operation is successful, set
                e.CancelableArgs.Cancel = false;

    Additional Links

    For more information about creating and publishing Sandboxed Solutions see Phil Newman's post on
    Introduction to Sandboxed Solutions - Sort data in repeating tables using managed code

  • Microsoft InfoPath 2010

    Peer to Peer Solutions using SharePoint Workspace 2010


    In the 2nd of 2 videos about InfoPath 2010 and SharePoint Workspace integration, Shirish Pulikkal from the InfoPath test team shows how to create and maintain an Asset Tracking list for both online and offline use, using InfoPath designer and SharePoint Workspace.

    The Scenario: In the 1st video, Taking a list offline using SharePoint Workspace 2010, Shirish showed how to take a SharePoint Asset Tracking list offline in SharePoint Workspace. Smaller organizations with budget constraints may not have access to a SharePoint Server. In this video we show you how to create and maintain an Asset Tracking list for both online and offline use, using just InfoPath and SharePoint Workspace.

    The Process: We use an Asset Tracking form and Categories form for the demo. Initially the Categories form is imported into SharePoint Workspace and we enable lookup to the list tool containing the Categories form. Next we design a new form for Asset Tracking from within SharePoint Workspace and add a SharePoint Workspace data connection to the Categories form. Then we import the Asset Tracking form in list tool in SharePoint Workspace, publish the tool and make the form available to other users subscribed to the workspace to create new list items. This is an example of a peer to peer scenario. The changes you make in your workspace will be immediately visible to other users subscribed to your workspace.

    Get Microsoft Silverlight
Page 1 of 1 (3 items)