Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

April, 2010

  • Microsoft InfoPath 2010

    Debugging Sandboxed Code in InfoPath 2010 Forms

    • 13 Comments

    In this video demo, Phil Newman from the InfoPath program management team shares some tips and tricks for debugging InfoPath forms with sandboxed code on SharePoint server 2010.

    Get Microsoft Silverlight

    Here is this link to the ULS viewer tool that is used in the demo:

    Filters:

    • Process=SPUCWorkerProcess (for administrator-approved forms, filter on the W3WP process)
    • Message=Exception thrown from business logic
  • Microsoft InfoPath 2010

    Comparing SharePoint List and Form Library Forms

    • 32 Comments

    So you’ve heard about SharePoint list form customization in InfoPath 2010 and you’ve seen the cool demos. But you may be asking yourself – What’s the difference between list and library forms and when should I use one or the other? In this post, we will answer these questions and provide guidance on when to create list vs. library forms.

    When designing InfoPath forms for SharePoint 2010, the first choice you need to make is between a SharePoint list form and a SharePoint form library form.

    Popular Form Templates

    Recommendation

    Use a list form if you just need to collect data and store it on SharePoint. Use a form library form if you want more advanced functionality such as complex or repeating data or code.

    What are list forms and form library forms?

    SharePoint list forms store data directly in a SharePoint list.  Each control (e.g. text box) in the form is bound to a column in the list. SharePoint list forms are directly connected to the list, which means that you don’t have to worry about setting up the publish and submit locations.
    Form library forms store data in XML files in a SharePoint form library. This means they are more flexible and you can do more with them. For example, they can be configured to save drafts and submit to different locations. However, they are more complex to work with and require more decisions to be made during configuration.

    Because the way data is stored between these template types is different, it is not possible to switch between them.

    Guidelines

    Here are some basic guidelines to help you decide what type of form to design.

    Use a list if:

    • You want to quickly get started building InfoPath forms on SharePoint
    • You need to use your form offline with SharePoint Workspace (formerly Groove)
    • You want to filter your SharePoint list based on a person or group
    • You would like to use the built-in display / edit views

    Use a form library if:

    • You have repeating or nested data
    • You are working from a predefined industry or complex schema
    • Your form needs to be digitally signed
    • You need code in your form
    • Your form is not hosted in SharePoint or you need to store results as an XML document

    How can I build advanced functionality into my forms?

    In general, form libraries provide better support for more complex and advanced forms. Here are a few examples of the way InfoPath can be used to build more powerful forms.

    Repeating data or complex schema

    • In some cases, you will want to collect repeating data in a form. For example, you have a project proposal form and want to include a list of potential risks for each project, or you have a book request form where users can request multiple books at once.
    • If you have a schema that has any nesting or repeating structures, or a defined industry schema such as Dublin core or Health Level 7, form library forms will allow you to organize your fields into groups to match your schema as opposed to having to flatten your schema to work with a list.
    • SharePoint lists store only one value per column; you can’t use list forms to store repeating data in a single item. As form library forms use XML to store data they can store repeating data in a single form.

    Using repeating data in list forms

    • If you have a SharePoint list form, you have several options for dealing with repeating data other than using the built in support of a form library.
    • If part of your content is repeating, consider flattening that schema so that it can repeat. For example, you could limit your book request form to no more than ten books per form.
    • You can also use multiple lists and link them together using lookup fields and web part connections. This works well for master/detail scenarios where one list tracks all the items and another contains the specific details for each item.

    Using repeating data in form library forms

    • Form library forms include controls that are designed to deal with repeating data inside the current item.  Form libraries have built-in support for repeating data with controls such as plain list, bulleted list, numbered list, repeating table, and repeating section.
    • They also support more customization of the form using the choice group and choice section controls. Advanced choice controls such as option button and optional sections are also available. All of these controls will be available by default in the controls gallery in InfoPath Designer for form library forms.

    Digital Signatures

    Managed Code

    • Form libraries support code-behind. This will allow you to do actions beyond logic in your form, such as advanced financial calculations.
    • Code can be used to extend InfoPath functionality or create custom business logic.
    • For example, in a pet food store you may use an InfoPath form to track food orders and use code behind the scenes to make sure you have enough inventory to meet the order and make sure that it isn’t sold before the form is submitted.
    • For more detail about forms with code, see Introduction to Programming in InfoPath 2010.

    Control over where your form is stored

    • Form libraries allow you to choose the location of where your form XML is sent when the form is submitted.
    • If you need to store your form as an XML document for use outside of SharePoint, then you should use a form library.
    • For example, if you have an insurance questionnaire and you want to store the completed form in a document collection with related content, a form library will allow you to do this.

    Bottom line

    Overall, both list forms and form library forms support much of the key functionality that InfoPath provides, such as data validation, custom rules, default values, and control over visual layout. In most cases, a list form will be sufficient for your needs. Lists have the most straightforward design and form management experience. However, for more complex scenarios such as repeating data or the need to add code, a form library may be necessary.

    Please leave a comment if you have any further questions!

    Daniel Broekman and Kate Everitt

    InfoPath Program Managers

  • Microsoft InfoPath 2010

    Cool Forms! Feature Request Form

    • 0 Comments

    This week’s cool form is a feature request issue tracking list used by the Visio team. It’s divided into two main sections, the separate status section allows readers to jump directly to the information they care most about. It uses picture buttons to allow selection between ‘Office 14’ and ‘Office 15’ and to show which one is currently selected.  This form also dynamically generates the proper direct link to the bug database based on the bug ID that is entered.

    Feature Request Form

    If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -

    • Attach 1 or 2 screenshots of your form
    • Provide a brief description of the form
    • You may also attach the XSN file (optional)

    The most popular submissions will be featured on our blog in future posts.

    Check out other Cool Forms here.

  • Microsoft InfoPath 2010

    Capacity Planning for SharePoint 2010

    • 0 Comments

    Check out the new Capacity Management Resource Center for SharePoint 2010 that went live when Office 2010 released to manufacturing last Friday, April 16th.  The InfoPath capacity planning document  along with a refresh of the Capacity Planning Tool Kit are now available.

    The Capacity Management Resource Center contains resources to help you with capacity management in your Microsoft SharePoint Server 2010 environment—map your solution design to a farm size and set of hardware that supports your business goals.

  • Microsoft InfoPath 2010

    Using Multiple Views in Customized List Forms

    • 19 Comments

    Hi, my name is Laura Harrington, and I’m a program manager on the InfoPath team. In this short video demo, I will show how you can optimize the form filling experience for different tasks and users by creating multiple custom views in your customized SharePoint list forms.

    Get Microsoft Silverlight
  • Microsoft InfoPath 2010

    InfoPath 2010: Menu to ribbon reference workbook

    • 1 Comments

    Find the new locations of InfoPath 2007 commands in InfoPath 2010. The InfoPath 2010 menu to ribbon reference workbook contains tables that list the old menu commands and show where in InfoPath 2010 those commands are located.

    This Excel workbook is now available to download from http://office2010.microsoft.com/en-us/templates/CL101817133.aspx.

  • Microsoft InfoPath 2010

    Person / Group Picker Improvements in InfoPath 2010

    • 51 Comments

    Hi, this is Frank Mueller, a developer on the InfoPath team. In this post which is the first of two blog posts about the Person / Group picker, I want to tell you about the improvements we’ve made to this control in InfoPath 2010.

    The Person / Group Picker (aka contact selector) control allows you to type or select users and groups from a SharePoint site, and validate those users against a directory provider. In InfoPath 2010, the Person / Group Picker control is now a 1st class citizen and is available out of the box in the controls gallery! With the new and improved person / group picker, we have eliminated the detailed steps required to insert and configure this control in your forms (the blog post outlining these steps has been one of our most viewed posts). In addition to making the control available in the controls gallery out of the box, we have added new features to improve its integration into SharePoint scenarios.

    For information on how to upgrade InfoPath 2007 forms with Person/Group Picker controls to InfoPath 2010, click here.

    Adding the Person/Group Picker to your form

    From the Controls Gallery on the Home tab or the Controls task pane, click the Person/Group Picker to insert it into the view.

    Controls Gallery

    Specifying a SharePoint site to query for people and groups

    The Person/Group Picker needs to connect to a SharePoint site to be able to function. Specify the SharePoint site as follows, unless you have already published the form to a SharePoint site, in which case that site will be used.

    1. Right-click the control in the view and select Person/Group Picker Properties from the context menu
    2. In the Person/Group Picker Properties dialog, select the SharePoint Server tab
    3. Type the URL of the SharePoint site you want to query

      Control Properties

    4. Click OK to close the dialog

    Specifying data validation (optional)

    In InfoPath 2010 it is now possible to mark the field the people picker is bound to as Cannot be blank. This means that users will not be able to submit a form without having entered at least one valid person or group in the control. You can mark a field as required by doing the following:

    1. Select the control in the view
    2. In the Properties tab in the Modify chunk, click the Cannot be blank checkbox

     

    PPickerCBB

    Testing the control

    Preview the form in InfoPath Designer or publish the form to a SharePoint site and view the form, enter a name or logon alias, click the “Check Names” button and resolve the name! Alternatively, you can click the “Address book” button to perform a search if you do not know the complete name of the user.

    For information on how to upgrade InfoPath 2007 forms with Person/Group Picker controls to InfoPath 2010, check out my other post here.

    Frank Mueller

    InfoPath Developer

  • Microsoft InfoPath 2010

    Upgrading InfoPath 2007 forms with Person/Group Pickers to InfoPath 2010

    • 6 Comments

    Hi, this is Frank Mueller again and this is the second of two posts that I’ve written about the InfoPath 2010 Person / Group picker control. InfoPath 2007 form templates containing the Person/Group Picker control (formerly named Contact Selector) will continue to work in InfoPath 2010 the same way they used to as long as the form template remains in the InfoPath 2007 Form Template format. However, if you wish to upgrade your form template to InfoPath 2010 to take advantage of newly added functionality for the control (see this blog post for more details) or other exciting new features, you will have to perform the steps outlined in this post in order to use the Person/Group Picker.

    Attention:
    If you follow the steps outlined in this blog post to change your form template, you are changing the data schema of the form template. This means you will not be able to view any previously filled out forms with the new form template. In order to avoid data loss, you should create a new InfoPath 2010 version of your form template and publish it to a different location. This way you can continue to view previously filled out forms with the InfoPath 2007 version of your form template.

    Saving the form template in InfoPath 2010 form template format

    1. Click the File button and select Save As
    2. In the Save As dialog select the corresponding InfoPath 2010 Web Browser or Filler Form Template in the Save as type dropdown.
    3. Change the file name to be something different so that you don’t overwrite your existing form template
    4. Click Save

    Removing existing versions of the control from the form

    After the form template is saved in the new format, you will notice that each Person/Group Picker in your view will show the following error message when you hover your mouse cursor over it.

    Incompatibility error visual

    Also the Design Checker task pane appears, indicating that the version of the Person/Group Pickers in the view is not compatible with InfoPath 2010. For each Person/Group Picker in all views, do the following:

    1. Select the Person/Group Picker control in the view
    2. Notice that the XML node tree that the control is bound to will be highlighted in the Fields task pane (if the Fields task pane is not visible, click Show Fields on the Data tab in the Ribbon).
    3. Delete the highlighted XML node tree by deleting the root node in the Fields task pane (Right-click the node, and select Delete from the context menu)                                                   Fields Task pane
    4. Select the Person/Group Picker control in the view and delete it
    5. Use the Controls Gallery on the Home tab to insert a new Person/Group Picker at the position in the view where you just deleted the control
    6. Right-click the newly inserted control in the view and select Person/Group Picker Properties from the context menu
    7. In the Person/Group Picker Properties dialog select the SharePoint Server tab
    8. Type in the URL of the SharePoint site (If you don’t know the SharePoint site that the control used to connect to, please follow the optional steps at the end of this blog post.) Control Properties
    9. Click OK to close the dialog

     

    Testing the Person / Group Picker

    Preview the form in InfoPath Designer or publish the form to a SharePoint site (be sure to publish to a different location in order to be able to view previously filled out forms) and view the form, enter a name or logon alias, click the “Check Names” button and resolve the name! Alternatively you can click the “Address book” button to perform a search if you do not know the complete name of the user.

    Configuring advanced SharePoint list control properties (optional)

    To configure advanced control properties  that are new in InfoPath 2010, such as limiting the entities the control can pick, as well as requiring the control to contain data before the form can be submitted, follow the steps in this blog post.

    Determining the SharePoint site URL (optional)

    If you added the control to your InfoPath 2007 form template following the steps outlined in this blog post, you will have created a data connection called Context, which specifies the SharePoint site the Person/Group Picker should connect to. Follow these steps to recover the data connection XML file and obtain the URL of SharePoint site:

    1. Start InfoPath Designer 2010 and open your InfoPath 2007 form template
    2. Click the Data tab and select Resource Files Data Tab - Resource Files
    3. In the Resource Files dialog select Context and click on the Export button to save the data connection XML to a location on your hard drive.
    4. Open the XML file in a text editor (e.g., notepad)
    5. Write down the siteUrl to configure the Person/Group Pickers

    Frank Mueller

    InfoPath Developer

  • Microsoft InfoPath 2010

    Cool Forms! E-mails to CoolForm@Microsoft not getting through

    • 0 Comments

    It was brought to our attention that external e-mails that were sent to coolform@microsoft.com were not getting through. This issue has now been resolved.

    If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -

    • Attach 1 or 2 screenshots of your form
    • Provide a brief description of the form
    • You may also attach the XSN file (optional)

    The most popular submissions will be featured on our blog in future posts.

    Check out other Cool Forms here.

  • Microsoft InfoPath 2010

    Cool Forms! Weather Forecast Form

    • 8 Comments

    This week’s cool form displays your local weather forecast by using a REST Web Service data connection to pull in weather information from an online weather service. There are two views to the form, one minimal and one extended. The form contains linked picture controls that use rules to concatenate the Web service data and generate a URL pointing to images on the weather site. By hosting this form inside the InfoPath form Web part, you can display the latest weather forecast information on your SharePoint portal pages.

    Minimal View:

    weather_minimal

     

     

     

    Extended View:

    weather_extended 

    For more information about using REST Web Service data connections with InfoPath forms, see our earlier blog post http://blogs.msdn.com/infopath/archive/2010/02/11/add-a-dynamic-map-to-a-contact-form-using-rest-web-services.aspx.

    If you have a “cool” form that you would like to share with us, please send an e-mail with the following details to coolform@microsoft.com -

    • Attach 1 or 2 screenshots of your form
    • Provide a brief description of the form
    • You may also attach the XSN file (optional)

    The most popular submissions will be featured on our blog in future posts.

    Check out other Cool Forms here.

  • Microsoft InfoPath 2010

    REMINDER: Learn about InfoPath 2010 in Free Web Casts

    • 0 Comments

    If you want to learn more about InfoPath and SharePoint 2010 directly from the Microsoft product team, then sign up for the InfoPath 2010 Academy Live Series.

    There are 2 remaining sessions in the series. The next session “Form-Driven Mashups using InfoPath and SharePoint 2010", presented by Nick Dallett, an InfoPath program manager lead, will take place on Wednesday, April 7th from 8:30 AM to 10:00 AM (PST).

    If you missed our first 2 sessions, “An introduction to SharePoint applications using InfoPath 2010” and "Building SharePoint Applications with InfoPath 2010", you can view them on demand here. Just click the “Register Now” button.

    This is a great opportunity to learn all about our new features and scenarios directly from the product team, so sign up now!

    infopath_banner_ad_1_3

  • Microsoft InfoPath 2010

    Add items to a SharePoint list using managed code

    • 16 Comments

    In this video demo, Phil Newman shows how you can write managed code in an InfoPath form to add items to a SharePoint list, and then publish this form as a sandboxed solution to SharePoint.

    In InfoPath 2010, forms with code can now be published directly to SharePoint without requiring the farm administrator to approve and upload them! These forms run in a sandboxed environment which protects other resources on the SharePoint server from malicious code.

    Get Microsoft Silverlight

    For more details on publishing InfoPath forms with code as sandboxed solutions to SharePoint, see Phil’s earlier post Introduction to Sandboxed Solutions - Sort data in repeating tables using managed code.

    Here’s the code that was used in this demo:

    NOTE: To develop code using the SharePoint object model, you need to add a reference to Microsoft.SharePoint.dll to your VSTA project. This DLL is installed in %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\ISAPI with your licensed copy of Microsoft SharePoint Server.

    public void school_Changed(object sender, XmlEventArgs e)
    
    {
    
      using (SPSite FormSite = new SPSite(ServerInfo.SharePointSiteUrl.ToString()))
    
      {
    
        using (SPWeb FormWeb = FormSite.OpenWeb())
    
        {
    
          //Get the list and query for the item - "Schools" is the name of the list I am retrieving
    
          SPList LookupList = FormWeb.Lists["Schools"];
    
          SPQuery MyQuery = new SPQuery();
    
          //"Title" is the field where I keep the school name
    
          ///my:myFields/my:school is the xpath to the school field
    
          MyQuery.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + GetDomValue("/my:myFields/my:school") + "</Value></Eq></Where>";
    
          SPListItemCollection ReturnedItems = LookupList.GetItems(MyQuery);
    
          //Add the item to the lookup list if no items were returned in the query
    
          if (ReturnedItems.Count == 0)
    
          {
    
            SPListItem NewItem = LookupList.Items.Add();
    
            ///my:myFields/my:school is the xpath to the school field
    
            NewItem["Title"] = GetDomValue("/my:myFields/my:school");
    
                            
    
            //Set AllowUnsafeUpdates = true to update the database
    
            FormWeb.AllowUnsafeUpdates = true;
    
            NewItem.Update();
    
            FormWeb.AllowUnsafeUpdates = false;
    
          }
    
        }
    
      }
    
    }
    
    private string GetDomValue(string XpathToGet)
    
    {
    
      return this.CreateNavigator().SelectSingleNode(XpathToGet, this.NamespaceManager).Value;
    
    }
Page 1 of 1 (12 items)