Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

  • 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;
    
    }
  • Microsoft InfoPath 2010

    InfoPath Resources

    • 1 Comments

    InfoPathDev is a free resource, dedicated to bringing Microsoft InfoPath users the information and tools they need to be successful in their projects.

    • More than 10K members, 30K threads, and 50K posts—it is the community to ask questions, get answers, and collaborate
    • Microsoft MVPs frequently post, including three MVPs from Qdabra—expertise
    • Forums - content ranges from general and newbie questions to SharePoint and SQL integration, coding, publishing, and Microsoft InfoPath 2010
    • Downloads – template parts, videos, and tips to help you create powerful forms
    • Blogs – expert advice from InfoPath developers and testers, including MVPs

    You can also follow InfoPathDev on Twitter.

  • Microsoft InfoPath 2010

    Package and Re-use a SharePoint List Solution

    • 6 Comments

    This week’s post continues the theme of SharePoint list customization. In this short video demo, Roberto Taboada from the InfoPath program management team shows how you can quickly and easily re-use your customized SharePoint lists by packaging them as SharePoint list templates. This is a really powerful feature as it allows you to build and customize your SharePoint solutions once and re-use them as many times as you want.

    Get Microsoft Silverlight

    To learn more about customizing your SharePoint list forms in InfoPath, check out our earlier blog posts on the subject.

  • Microsoft InfoPath 2010

    Cool Forms! NCAA March Madness Bracket

    • 5 Comments

    This week’s cool InfoPath form is a browser form used to run a bracket tournament at Microsoft. The form uses filtered dropdowns to let users make their picks for NCAA March Madness 2010, and uses conditional formatting to show correct and incorrect picks as the tournament progresses. There’s also a printable view that shows the full bracket on one page, making it easy to print your bracket and show it off to your co-workers.

    The form contains several data connections to SharePoint lists containing participants and results, which means that updating the results is as simple as editing a SharePoint list item, and doesn’t involve changing the form at all.

    Edit View (click to see larger image):

    Edit View

    Display View (click to see larger image):

    Display View

    Print View (click to see larger image):

    Print View

    For details on how we created the filtered dropdowns in this form, see Use Rules and Filters to Create Cascading Dropdowns.

    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

    Introduction to Programming in InfoPath 2010

    • 28 Comments

    Hello, my name is Christopher Brotsos, and I’m a Program Manager on the InfoPath team. In this post, I’m going to show you how to add business logic to your forms using managed code.

    Imagine a scenario where the accounting department at Contoso, Inc. tracks corporate assets through an Asset Management System built on SharePoint. One module in the system allows employees to order office equipment such as laptops, conference phones, and ergonomic chairs through an InfoPath form. At first, the order form was built using only declarative logic. It could enforce required fields, surface validation messages, and submit the form to SharePoint without any code.

    As the ordering process grew more complex, users started adding additional requirements to the system. The variety of inventory available to employees increased, so they wanted a way sort items by name and description real-time in the order form. Contoso also started shipping their office equipment out of three warehouses. This prevented the warehouse crew from fulfilling complete orders, and as such, the system needed to track shipping status and quantity of individual items in the order. To meet the new requirements, Contoso added the following features to the form:

    • A custom sort interface
    • Logic for managing complex data when the form is submitted
    • Logic to add items to a SharePoint list

    Sort interfaces, sophisticated submit routines, and database (i.e. list) management are common requirements for forms. Fortunately, this functionality can be added to InfoPath forms with a few lines of code. Let me explain these features, the code required to build them, and the prerequisites for developing managed code in InfoPath in more detail.

    Equipment Request Form

    The employee orders module in the Asset Management system consists of three core components:
    1. A SharePoint form library, “Equipment Orders”, where users go to fill out the Equipment Order Request form shown below.
    2. A SharePoint list, “Equipment Inventory”, which stores the items available for users to order. This list contains fields specifying items’ names, descriptions, and quantities used to populate the Equipment Order Request form.
    3. A SharePoint list, “Equipment Shipping”, which stores a list of items ordered by users that have been scheduled for shipping. This list contains fields for the names and quantities of items being ordered as well as the name of the user who placed the order.

    The Equipment Request Form enables users to sort through Contoso’s available inventory and submit a request to the warehouse for shipping.

    Equipment Order Request Form

    The order form is a repeating table, where each row in the table represents the name, description, and quantity of the item being ordered.

    Equipment Order Request Form 

    Sorting data in the form

    The Equipment Order Form has a Picture Button Control displaying an arrow next to each of the column labels.

    Equipment Order Request Form

    The buttons are used to sort the order items in ascending order by the respective column. When the user clicks the button, the values in the selected column are compared, and the rows of data are sorted based on the comparison result.

    The sorting routine in this example is based on a complete solution provided by Hagen Green. Read through his post to learn how to provide a descending sort which also takes localization and data types into consideration.

    private string GetValue(string xpath)
    
    {
    
      // return the value of the specified node
    
      XPathNavigator myNav = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
    
      if (myNav != null)
    
        return myNav.Value;
    
      else
    
        return "";
    
    }
    
    private void Swap(string xpath1, string xpath2)
    
    {
    
      // swap two rows of the table 
    
      XPathNavigator item1 = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath1, NamespaceManager);
    
      XPathNavigator item2 = this.MainDataSource.CreateNavigator().SelectSingleNode(xpath2, NamespaceManager);
    
      if (item1 != null && item2 != null)
    
      {
    
        // Make a copy of item1
    
        // Move item2 to item1
    
        // Make the original item2 be item1 that we cloned earlier
    
                    
    
        XPathNavigator item1Clone = item1.Clone();
    
        item1.ReplaceSelf(item2);
    
        item2.ReplaceSelf(item1Clone);
    
      }
    
    }
    
    private void SortOrder(string sortBy)
    
    {
    
      string itemsToSort = "/my:myFields/my:Order/my:OrderItem";
    
      XPathNodeIterator items = this.MainDataSource.CreateNavigator().Select(itemsToSort, NamespaceManager);
    
      if (items != null)
    
      {
    
        int numItems = items.Count;
    
        // basic bubble sort implementation
    
        for (int i = 1; i < numItems; i++) // xpath is 1-based
    
        {
    
          for (int j = i + 1; j <= numItems; j++)
    
          {
    
            // swap (i,j) if necessary
    
            string iValue = GetValue(itemsToSort + "[" + i + "]" + sortBy);
    
            string jValue = GetValue(itemsToSort + "[" + j + "]" + sortBy);
    
            if (String.Compare(iValue, jValue, true) > 0)                       
    
              Swap(itemsToSort + "[" + i + "]", itemsToSort + "[" + j + "]");
    
                            
    
          }
    
        }
    
      }
    
    }
    
    public void ItemNameSort_Clicked(object sender, ClickedEventArgs e)
    
    {
    
      // Sort order by ItemName
    
      // Repeat this code for the other buttons
    
      string sortBy = "/my:ItemName";
    
      SortOrder(sortBy);
    
    }
    

    Managing complex data during submit and updating SharePoint lists using the SharePoint object model

    The user is eventually going to finish selecting items and submit the order. Each item ordered through the form is handled independently because, for example, an item in the order may be delayed or shipped from a remote warehouse. So, we need submit logic which will break up the complex data (i.e. the repeating table of items being ordered) into individual rows, and add a shipping request to the Equipment Shipping list for each item-quantity pair. After an item is added to the Equipment Shipping list, a SharePoint workflow is used to track status and manage the Inventory Equipment list’s quantity values.
    1. The first thing you’ll need to do is use the Submit Options button on the Data tab in the ribbon to add a custom submit handler to your VSTA project.

      Submit Options

    2. Add a reference to Microsoft.SharePoint.dll to your VSTA project. This will allow you to develop code using the SharePoint object model. This DLL is installed in %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\ISAPI with your licensed copy of Microsoft SharePoint Server.
    3. Add custom submit logic to create a SharePoint list item for each item in the order form. See the code below for an example, and notice the use of the ServerInfo class. The ServerInfo class is new to InfoPath 2010 and allows you to write portable code with relative references to SharePoint server URLs.

     

    public void FormEvents_Submit(object sender, SubmitEventArgs e)
    
    {
    
      // Loop through each item-quantity pair in the order form.
    
      // Submit pairs to the Equipment Shipping list.
    
      // Note: Workflow will handle updating item quantities and track shipping status.
    
      using (SPSite mySite = new SPSite(ServerInfo.SharePointSiteUrl.ToString()))
    
      {
    
        using (SPWeb myWeb = mySite.OpenWeb())
    
        {
    
          XPathNodeIterator orderItems;
    
          if (myWeb != null && myWeb.Lists["Equipment Shipping"] != null)
    
          {
    
            SPList shippingList = myWeb.Lists["Equipment Shipping"];
    
            myWeb.AllowUnsafeUpdates = true;
    
            orderItems = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:Order/my:OrderItem", NamespaceManager);
    
            if (orderItems != null)
    
            {
    
              while (orderItems.MoveNext())
    
              {
    
                // Add rows from the form where user selected an item and specified a quantity.
    
                string itemName = orderItems.Current.SelectSingleNode("./my:ItemName", NamespaceManager).Value;
    
                string itemQuantity = orderItems.Current.SelectSingleNode("./my:ItemQuantity", NamespaceManager).Value;
    
                if (itemName != string.Empty && itemQuantity != string.Empty)
    
                {
    
                  SPListItem shipItem = shippingList.AddItem();
    
                  shipItem["Title"] = itemName;
    
                  shipItem["Quantity"] = itemQuantity;
    
                  shipItem.Update();
    
                }
    
              }
    
            }
    
          //cleanup
    
          //signal successful submit
    
          //return
    
          myWeb.AllowUnsafeUpdates = false;
    
          e.CancelableArgs.Cancel = false;
    
          return;
    
          }
    
        }
    
      }
    
    }
    

    Along with the features covered above, you’ll find that code is useful for implementing complex data validation logic and managing content from multiple data sources. Such requirements are especially common when your forms are part of an advanced application. You can learn more about validation and working with the InfoPath DOM in our MSDN XmlEvent.Validating documentation and our post on working with InfoPath data sources programmatically. You can also review the InfoPath and SharePoint object models on MSDN for a more granular view into programming with InfoPath 2010.

    If you’d like to get started with programming in InfoPath, then please read on. The rest of this post introduces our system requirements, integrated development environment, and programmability user experience.

    How to add code to an InfoPath form

    To add code to an InfoPath form:

    1. Make sure you meet the minimum system requirements.
    2. Install Visual Studio Tools for Applications (VSTA).
    3. Choose a programming language.
    4. Add event handlers and code.

    Minimum system requirements

    The minimum system requirement to get started with InfoPath 2010 development is Microsoft .NET Framework 2.0, but we suggest you install Microsoft .NET Framework 3.5 SP1 if you’re developing for the SharePoint platform. You can install all versions of Microsoft .NET Framework from http://www.microsoft.com/downloads.

    Installing Visual Studio Tools for Applications

    Visual Studio Tools for Applications (VSTA) is an optional installation component available in Microsoft Office 2010 setup. To install VSTA:

    1. Launch Office 2010 setup from your Office 2010 installation media or from the Control Panel Programs and Features application.
    2. If you’re installing a new copy of Office 2010, click the Customize button in the installer. If you’ve already installed Office 2010, choose the Add or Remove Features radio button in the installer.
    3. Set the Visual Studio Tools for Applications option to Run from My Computer and continue through the setup wizard.

    Office Setup

    Choosing a programming language

    InfoPath 2010 allows you to program in C# and Visual Basic .NET. If you want to program with Visual Basic, you do not need to do anything to select your programming language when designing InfoPath 2010 compatible forms. If you plan on programming with C#, or adding code to InfoPath 2007/2003 compatible forms, you can change the programming language by clicking the Language button in the Code group of the Developer tab.

    Developer Tab

    After you click the Language button, you can change your programming language by using the Form template code language drop down:

    Form Options

    Hint: You can change the default language for InfoPath 2010 compatible forms by using the Options menu in the Backstage.

    1. Click the File > Options tab
    2. Click the More Options button in the General category of the InfoPath Options dialog
    3. Change the Programming language dropdowns in the Programming Defaults section of the Design Options

    Options

    Adding event handlers

    The Developer tab is the primary entry point for programming in InfoPath 2010. It’s designed to help you add event handlers compatible with the controls and mode of the form you are designing. For example, if you don’t have a control selected on your form view, then you’ll only be able to select the events that apply to the entire form. Notice that the Loading and View Switched event below are enabled, but the entire Control Events group is disabled.

    Developer Tab

    But, as soon as I select a text box on the form, the Control Events group lights up.

    Developer Tab

    Notice that the Sign, Context Changed, and Changing events are disabled in both screenshots of the Developer tab. That’s because I’m working with a browser compatible form, and those events are only available for InfoPath Filler forms.

    Note: You’ll find a table of all events, and their compatibility, towards the end of this section.

    Certain control and form programming events can be accessed through buttons on other tabs in the ribbon. If you add a Picture Button control on the form view, highlight the button, and then click on the Properties tab then you’ll find the Custom Code button enabled. Clicking the Custom Code button in the ribbon will add an OnClick event for the Picture Button control.

    Custom Code Button

    In the Equipment Order Request form, we added a Submit event handler to add items to a SharePoint list. To do this, navigate to the Data tab, and click the Submit Options button in the Submit Form group.

    Submit Options Button

    This will launch the Submit Options dialog where you can check “Allow users to submit this form”, “Perform custom action using Code”, and then click the Edit Code button.

    Submit Options

    The Fields task pane is another main entry point to add event handlers. In the next screenshot, I access the Validating and Changed events for ItemDescription by right clicking the field in the Fields task pane and scrolling through its context menu.

    Fields Taskpane

    The following tables provide a list of all events and compatibility in InfoPath 2010. Note that InfoPath forms trigger three types of events: Form Events, Data Events, and Button Events. Aside from the button event, InfoPath event handling is different from other web programming paradigms (e.g. WinForm and HTML forms); events are fired when the data changes, not when control state changes. As such, you should consider the optimal configuration for your forms’ post-back settings to provide the best performance while still ensuring that events get fired when necessary. See our performance post on MSDN to learn more about general performance and event handler post-backs.

    Tables

    After you’ve designed your form and authored the source code, the final step is to publish the form. Your InfoPath form with code can be published to SharePoint and to client machines, but you need to make a security decision before you publish: configure the form as domain trust or full trust.

     

    Domain trust forms can be published to SharePoint as Sandboxed Solutions directly from the InfoPath 2010 Designer. With Sandboxed Solutions, SharePoint Server farm administrators can restrict the resources available to the code and developers cannot access resources subject to operating system security. This establishes a safe environment where Site Collection administrators can publish code to SharePoint without the overhead of administrator approval! For more details about Sandbox Solutions (and another method for sorting repeating tabular data), see our Introduction to Sandboxed Solutions post from Phil Newman.

    Note: Publishing full trust forms to a client-side environment requires that the form is signed with a code-signing certificate or installed through a custom MSI built in Visual Studio. Publishing a full trust form to SharePoint requires a farm administrator to activate the solution through the SharePoint Central Administration portal.

    Best Practice: You should always use the lowest level of trust possible when publishing forms.

    Summary

    Most forms you design with InfoPath 2010 are not going to require code, but when they do, just install Visual Studio Tools for Applications and you’re ready to start programming. To add code, select the language of your choice, and use entry points in the Ribbon and Fields task pane to automatically insert event handlers. Finally, decide whether or not your form requires full-trust, and publish it to SharePoint or a client environment accordingly. If you’re interested in learning more about the InfoPath and SharePoint programmability, please visit http://www.msdn.com and keep checking for updates here on the InfoPath blog.

  • Microsoft InfoPath 2010

    Customize an External List Form in InfoPath 2010

    • 8 Comments

    In this week's “5 for forms” video demo, Trey Brumley, a software design engineer in test shows how you can use InfoPath to customize the form for an external list on SharePoint that connects to a SQL Employee database through Business Connectivity Services.

    Get Microsoft Silverlight
  • Microsoft InfoPath 2010

    Cool Forms! Team Signoff Form

    • 2 Comments

    This week’s cool InfoPath form is a simple form that we’re using for each team in Office to sign off that Office 2010 is ready to ship. One of the neat things about this form is that it makes the signoff process a visual experience by using conditional formatting to show and hide pictures based on the status.

    Signoff 1

    The form also contains rules to enforce that final signoff can only happen once both bug and testing signoffs have been completed.Signoff 2

    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.

    Thanks!

    The InfoPath Team

  • Microsoft InfoPath 2010

    And the winner is…

    • 0 Comments

    The InfoPath Solution Video Contest is over! We assembled the team last Friday, and screened the final submissions, debated, re-watched, debated, re-screened again, and finally voted to determine the winners.

    The Contestants

    Before we announce the winners, let’s review the contestants. At final count at the close of the contest (midnight on March 1st ), we had received three submissions:

    (1) Leave Request form

    Author: Clayton Cobb

    Company: Planet Technologies

    Clay’s solution allows members of his “company” (including his 3 year old son!) to submit a request for time off. Employee information, including vacation balances, are stored in a SQL server database, which is modelled in Business Connectivity Services and exposed on SharePoint as an External List. Clay used an InfoPath Form Library form, which queries data from the external list using a SharePoint List data connection. A SharePoint workflow routes approval and other notifications via e-mail, and then updates the External list with a new vacation balance once the request is approved.

    Click the image to view Clay’s submission

    LeaveRequest

     

    (2) Elle Knowledge Management

    Author: Eric Raarup

    Company: Inetium

    Elle is a knowledge management solution which uses a cool Silverlight interface to knit together a complex solution involving projects in Dynamics CRM and employees in Dynamics GP, exposed in SharePoint using Business Connectivity Services, with InfoPath forms for data input.

    Click to view the Inetium submission:

    Inetium

    (3) Grant Proposal

    Author: Estyn Edwards

    Company: Iomer Internet Solutions

    Estyn’s submission is a prototype created for a client of the Edmonton-based Iomer solutions. The grant proposal system features a multi-view InfoPath form, and a Word document which uses content controls to populate a custom XML document in an OpenXML file. The Word document allows users to author large amounts of rich content, including ad-hoc commenting and change tracking. At the end of the process, custom code in SharePoint shreds the XML out of the Word document and injects the content into the InfoPath form for final verification and printing.

    Click below to view Estyn’s submission:

    ProgramProposalForm

    The Winners!

    After several viewings and a lively discussion, 17 InfoPath team members voted on the three submissions to determine the final prizes. There were passionate proponents of each of the submitted videos. When the votes were tallied up, the standings were as follows:

    Overall Best Solution

    Eric Raarup of Inetium takes the top prize and walks away with the Xbox 360 Elite! The slick presentation of the video, the impressive solution to the knowledge-mining problem, and the clean integration of a bewildering array of Microsoft technologies makes Inetium the clear winner here.

    Best use of InfoPath 2010 and SharePoint 2010 features

    Clayton Cobb of Planet Technologies takes this prize for his clever integration of external lists with SharePoint workflow and InfoPath forms. Because Clay was the runner-up in two categories, he takes his choice of either an InfoPath-branded North Face jacket, or a Zune HD.

    Most Elegant Solution Design

    Estyn Edwards takes this prize for his attractive InfoPath forms and the innovative use of Word to enable collaborative authoring of a large volume of rich text. Estyn will have second choice of either the InfoPath-branded North Face jacket or the Zune HD.

    Thanks to our three participants, and congratulations!

    For those of you who did not submit a video for the contest, we’re still interested in seeing the great solutions you build using InfoPath and SharePoint 2010. Post your videos on any public video hosting site, and send a pointer to the e-mail address listed in the official contest rules. The best videos will be showcased in this blog.

    -Nick Dallett

    Program Manager Lead

    Microsoft InfoPath

  • Microsoft InfoPath 2010

    Use Rules and Filters to Create Cascading Dropdowns in Forms

    • 11 Comments

    Hi, my name is Anson Hidajat and I’m a program manager on the InfoPath team. In this week's “5 for forms” video demo, I will show how you can use rules and filters to create cascading dropdown lists in a tennis tournament bracket application.

    Get Microsoft Silverlight

    Enjoy and please send us your feedback!

  • Microsoft InfoPath 2010

    Create Code-Free Mashups with InfoPath and SharePoint Web Parts

    • 3 Comments

    Hi, My name is Nicholas Lovell and I’m a developer on the InfoPath team. In this video demo, I will walk through how to create a simple portal page for processing claims at an insurance company. This claims portal includes a SharePoint Web Part with a list of all the claims, an InfoPath Web Part that displays the claim details, and a custom Bing Maps Web part which displays the location of the currently selected claim.

    Get Microsoft Silverlight

    Enjoy and please share your comments with us!

    Nick

  • Microsoft InfoPath 2010

    Cool Forms! Team Status Tracking Form

    • 0 Comments

    This week’s cool InfoPath form is a form used by one of the teams at Microsoft to track their status. It uses conditional formatting for color coding the status to make it easy to see progress at a glance. By recording team status on their SharePoint site, everyone knows how the team is doing and where they need to focus their energy. As new milestones are added to the project, they are added to the form.

    Team Status

    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

    Thanks!

    The InfoPath Team

  • Microsoft InfoPath 2010

    Only 10 days left to be in with a chance to win an XBox 360 Elite!

    • 0 Comments

    Have you submitted your entry for the InfoPath and SharePoint 2010 solution contest yet?

    If not, hurry up! There are only 10 days left to submit your entries.

    For a taste of what we’re looking for, here’s one entry from Clayton Cobb of the Colorado SharePoint users group.

    Think you can do better? Click here to see how to enter.

    Please note that only legal residents of the US and Canada are eligible for prizes.  However, we're eager to see videos from everyone, and we will showcase the best videos we receive, regardless of whether you are awarded a prize.

  • Microsoft InfoPath 2010

    Learn about InfoPath 2010 in free Web casts with the Microsoft Product team!

    • 0 Comments

    Do you want to learn about InfoPath and SharePoint 2010 in FREE Web casts with the InfoPath product team? Then sign up for the InfoPath 2010 Academy Live Series.

    There are 3 remaining sessions in the series. The next session “Building SharePoint Applications with InfoPath 2010” will take place on Wednesday, March 10th from 8:30 AM to 10:00 AM (PST).

    If you missed our 1st session, “An introduction to SharePoint applications using InfoPath 2010”, you can view it 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

  • Microsoft InfoPath 2010

    Digital Signature Support in InfoPath 2010

    • 32 Comments

    Hi, this is Gergely Kota, a developer on the InfoPath team. Digitally signing data when filling out a form makes the data tamper-proof, authenticates its signer, and is a key component of trusting form data. In this post, I’d like to share the improvements that have been made to digital signature support in InfoPath 2010. InfoPath 2010 allows you to make more secure signatures with improved cryptographic algorithms and makes long-term storage of signed forms more robust by supporting 3rd-party time stamping. This post describes these improvements and shows you how to strengthen any signature created in InfoPath 2010 Filler. For a primer on digital signatures, read an Introduction to Digital Signatures in InfoPath.

    Note - Data signing should not be confused with code/template signing, which remains unchanged.

    Signature Security

    Digital signatures are only as secure as the cryptographic algorithms they use to ensure signed data hasn't been tampered with. InfoPath 2007 and 2003 support RSA or DSA for signing and SHA1 for hashing. Though a combination of RSA and SHA1 is considered secure for now, algorithms become exposed to attack over time and are eventually rendered obsolete. If either the signing or hashing algorithm is cracked or compromised, the integrity of the signature can no longer be verified. InfoPath 2010 enables you to address these concerns by supporting newer, more secure, ECC signing and SHA-2 family of hashing algorithms.

    Signing with a particular algorithm

    When creating a signature, a user may sign with one of potentially many certificates installed on their machine. The signature algorithm is determined by the chosen digital certificate. To determine the algorithm:

    1. Begin the signing process Clickhere to sign
    2. Change your signing certificate ChangeCert
    3. Highlight desired certificate and click View Certificate 
    4. Look at the Public key field under the Details tab Viewcert

    Administrator Settings: Hashing algorithms

    By default, InfoPath 2010 hashes signature data using SHA1. This is done to maintain backwards compatibility with InfoPath 2007 and InfoPath 2003. InfoPath 2010 also supports the SHA2 family of hashing algorithms. If backwards compatibility is not a concern, an administrator can set the hashing algorithm in the registry.

    HKCU\Software\Microsoft\Office\14.0\Common\Signatures\SignatureHashAlg
    Value Description
    “sha1” (default) SHA1 hash algorithm
    “sha256” SHA256 hash algorithm
    “sha384” SHA384 hash algorithm
    “sha512” SHA512 hash algorithm

    Signing and Hashing Algorithm Compatibility

    The following table shows which versions of InfoPath are able to sign and/or verify signatures with the given combinations of signing and hashing algorithms:

    DigSigAlgoSupportMatrix

    Long-term Signature Support

    Certificates guarantee the identity of the signer, but expire after a while. This is to reduce the time attackers have to deduce an associated private key (which would allow them to impersonate a signer) and to limit the shelf-life of a compromised certificate. Certificates may also be revoked if they are taken out of commission before their expiration date. If the certificate used to create a signature is now expired or revoked, we should be cautious of whether the signed data is valid or not unless we can verify that the data was signed while the certificate was still valid. This poses an impending problem because all certificates expire (often in a year!), and we would require a trusted timestamp to confirm when the signature was created. Without such a trusted timestamp, InfoPath will show the signature as invalid, with the reason in the Signature Details dialog:

    InvalidSignature

    sigdetails_full_expired

    This can be especially problematic, for example, for a printed copy of the form which would show an invalid signature, and there would be no way to verify why. InfoPath 2010 adds support for XML Advanced Electronic Signature (XAdES), which allows for adding a trusted timestamp that can be used to resolve when the signature was added relative to the signing certificate's expiration and/or revocation time (see a detailed discussion of XAdES in Microsoft Office for details and level options). If such a timestamp exists and confirms that the signature was made when the signing certificate was valid, InfoPath can safely conclude that the signature is entirely valid:

    ValidSignature

    sigdetails_full_good

    Server Support

    InfoPath 2010 Forms Services signs forms using RSA and SHA1, and is able to verify any signature created in the InfoPath 2010 client. XAdES is a client-only feature.

    Final Word

    By leveraging the security improvements and time-stamping support described in this post, you are increasing the strength and longevity of your signatures. Happy signing!

    Gergely, InfoPath dev

  • Microsoft InfoPath 2010

    Add a Dynamic Map to a Contact Form using REST Web Services

    • 25 Comments

    Update: Due to a change in the Bing Maps REST Web Service, the steps outlined in this blog post no longer work. We are looking into the possibility of using a different API, and will update this post soon with details.

    Hi, Phil Newman here from the InfoPath team. In this post, I’ll explain how to use the new REST Web service data connection in InfoPath 2010 to add a dynamic map to a contacts form. The form connects to two Web services. The first is a REST Web service that returns the coordinates of a given address from Bing Maps, the second returns an image of a map for a given coordinate set. When users enter address information in the form, the map will update to display the specified address.

    Get Microsoft Silverlight

    The following steps assume that:

    1. You’ve already created your Contacts list in SharePoint and customized the form for the list in InfoPath.
    2. You have a Bing Maps key (see http://msdn.microsoft.com/en-us/library/ff428642.aspx)

    Add the Data Connections

    1. In InfoPath Designer, click “From REST Web Service” on the “Data” tab. Data Tab, From REST Web Service
    2. On the first page of the Data Connection wizard, enter the URL of the Bing Maps REST Web service that will return the GPS coordinates for the specified address. The URL must contain sample parameters that will return valid values at runtime. Otherwise the connection will not be configured. Data Connection Wizard - Web Service Details Here is my starting URL (you will need to replace YourBingMapsKey with your own Bing Maps key value) :
      http://dev.virtualearth.net/Services/v1/GeocodeService/GeocodeService.asmx/Geocode?culture=en-us&count=10&query=1%20Microsoft%20Way%20Redmond%20wa%20&landmark=&addressLine=&locality=&postalTown=&adminDistrict=&district=&postalCode=&countryRegion=&mapBounds=&currentLocation=&curLocAccuracy=&entityTypes=&rankBy=&key=YourBingMapsKey 
      Note that I’ve included a default address of “1 Microsoft Way Redmond WA” so that the Web service will return valid XML.
    3. On the next page of the Data Connection wizard, specify a name for the data connection. Since in this scenario we only want the map to be displayed when the user enters an address, clear the “Automatically retrieve data when the form is opened” check box, and click “Finish”. Data Connection Wizard - Data Connection Name
    4. Because the Bing Maps Web service is not on the SharePoint server, the data connection must be converted to a data connection (.udcx) file. Click “Data Connections” on the “Data” tab, select the data connection, and click “Convert to Connection File”. The connection file must be saved to a Data Connection Library on the SharePoint site and approved before it can be used.  (For more about data connections and UDC files, go here)Data Ribbon tab - Data Connections

    RESTSaveConnectionFile

    RESTSaveConnectionFile2

    Add a Rule to query the REST Web Service

    The next step is to create a rule to change the parameters in the REST Web Service URL based on the address values entered in the form. The Web service will then be queried using these parameters.

    1. Add a button to the form.
    2. Select the button and click “Manage Rules” on the “Home” tab.RESTManageRules

      (NOTE – the button is being used as a temporary placeholder for creating the rules. In InfoPath 2010, you can copy and paste rules between controls. We’ve built in smarts so that when you copy a rule to a different control, field references are updated. In this case we do not want the references to be updated so we will create the rules on the button and then copy and paste it on to the Address fields.)

    3. On the “Rules” task pane, click “New”, “Action” and add a “Change REST URL” rule action. 
    4. Build an expression that concatenates values in the form to create the URL RESTRuleDetails
      • In the “Insert Formula” dialog, select the existing URL  RESTInsertFormula
      • Click the “Insert Function” button and add the Concat function from the “Text” category.
      • Replace the default value for the address with parameters from the form. Since the Concat function concatenates strings, each hard coded string must be in quotes. Use the “Insert Field or Group…” button to add fields from the form to the expression.
      • Click OK in the “Insert Formula” and “Rules Details” dialogs. The underlined words in the image below are fields in the form being used as parameters in the URL. RESTInsertFormula2
      • Here is the Formula (you will need to replace YourBingMapsKey with your own Bing Maps key value) :
        concat("http://dev.virtualearth.net/Services/v1/GeocodeService/GeocodeService.asmx/Geocode?culture=en-us&count=10&query=", Address, ", ", City, ", ", State/Province, "&landmark=&addressLine=&locality=&postalTown=&adminDistrict=&district=&postalCode=&countryRegion=&mapBounds=&currentLocation=&curLocAccuracy=&entityTypes=&rankBy=&key=YourBingMapsKey") 
    5. Add a “Query for Data” rule action to query the REST Web Service with the new URL parameters.

    Add a Rule action to set the URL of the Map picture control

    To display the map of the current location in the picture control, append the latitude and longitude values returned by the Bing Maps REST Web Service to the URL for that image.

    1. Add a “Set a field’s value” rule action to set the URL of the picture control to the map of the current location.
    2. Set the value of the field to the following expression in which “Latitude” and “Longitude” are fields from the REST Web service response. The expression used to build the map image URL is as follows (you will need to replace YourBingMapsKey with your own Bing Maps key value) :
      concat("http://api.tiles.virtualearth.net/api/GetMap.ashx?ppl=24,,", Latitude, ",", Longitude, "&key= YourBingMapsKey")
    3. Add a condition to the rule so that it only executes if the Address, City and State / Province fields are not blank.
    4. Copy the rule from the button you created earlier and paste it onto the Address, City and State / Province controls.
    5. Add a rule to the picture control to hide it if the URL is blank.
    6. From the File tab, click “Quick Publish”.

    Now, open the form in the browser and fill it out. As soon as you have entered an address, the map of that location will appear in the form.

    3 important things to remember when using the REST Web Service data connection:

    1. Always start with a valid URL for your REST Web service.
    2. To change the parameters in the URL, add a “Change REST URL” rule action.
    3. To execute the connection, add a “Query for Data” rule action.

    Please leave a comment if you have any questions or feedback about this feature!

    Phil Newman

    Program Manager

  • Microsoft InfoPath 2010

    We want to see your Cool Forms!

    • 7 Comments

    Today sees the launch of “InfoPath Cool Forms”. In this series, we will feature cool forms that showcase a form design practice or interesting scenario.

    This week’s cool form is the “Ask Kanesha” request form.  This is a neat little form that we use on the InfoPath team to submit requests to our Group Business Administrator, Kanesha.

    Ask Kanesha

    Kanesha was being flooded with requests from team members and tracking all these requests was becoming a challenge. To help manage the requests, we created an ‘Ask Kanesha’ InfoPath browser form that submitted all requests to a SharePoint list. Team members use this form to submit requests. A simple workflow fires alerting Kanesha to the new request. Certain requests such as those for small hardware can be completed in minutes. The dropdowns in the form automatically filter to guide us to the right hardware. Other custom requests may take longer and can be managed by Kanesha online. The form saves us time and helps Kanesha keep track of all the requests that come her way.

    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

    Create a Loan Calculator using the InfoPath and Excel Web Parts

    • 0 Comments

    In this week’s “5 for Forms” video demo, Nick Dallett will show you how to create a loan calculator application without writing a line of code. This simple application leverages the power of the InfoPath and Excel Web Parts by using an InfoPath form to input the values that are sent to an Excel Workbook which contains the complex formulas that calculate the repayments.

    If you want to learn more about the new InfoPath Form Web Part, check out Nick’s earlier video demo – Managing data in your SharePoint Lists using the InfoPath Form Web Part.

    Get Microsoft Silverlight

    Enjoy and please let us know what you think!

    The InfoPath Team

  • Microsoft InfoPath 2010

    Sign up now for the InfoPath 2010 Academy Live Series!

    • 0 Comments

    Registration is now open for the 1st session in the InfoPath 2010 Academy Live Series, An Introduction to SharePoint Applications using InfoPath 2010, presented by Bojana Duke.

    In this series, you will hear directly from InfoPath product team members who will talk in-depth about  InfoPath and Forms Services 2010 and how you can quickly and  easily build applications in SharePoint without writing a line of code.

    Click the link below to sign up for this free event.

    Event Title: An Introduction to SharePoint Applications using InfoPath 2010 (INP02AL)
    Date/Time: Wed Feb 10, 2010, 8:30 AM, USA Pacific
    Event Registration URL: https://www.eventbuilder.com/event_desc.asp?p_event=e0b96f2a

  • Microsoft InfoPath 2010

    Create a SharePoint list using InfoPath 2010

    • 14 Comments

    This week’s “5 for forms” video demo continues the theme of SharePoint list customization. In the 1st video in this series, Daniel Broekman showed how you can take an existing list on SharePoint and customize the form for that list in InfoPath.

    In this week’s video demo, Ines Khelifi, a developer on the InfoPath team shows how you can create a new SharePoint list and custom form directly from InfoPath Designer.

    Get Microsoft Silverlight

     

    Enjoy and please send us your feedback!

    The InfoPath Team

  • Microsoft InfoPath 2010

    Announcing the InfoPath 2010 Academy Live Series!

    • 0 Comments

    Do you want to hear about the exciting, new features and scenarios that have been added in InfoPath and InfoPath Forms Services 2010? Then, sign up for our upcoming Academy Live series.

    In this series, you will hear directly from InfoPath product team members who will talk in-depth about  InfoPath and Forms Services 2010 and how you can quickly and  easily build applications in SharePoint without writing a line of code.

    The series will consist of 4 sessions presented by members of the InfoPath product team. We will present 1 session a month, starting with an “Introduction to InfoPath and InfoPath Forms Services 2010”, presented by Bojana Duke from the InfoPath program management team. This session will take place on Wednesday, February 10th at 8:30 AM (PST).

    Whether you are an InfoPath newbie or an experienced InfoPath user, we encourage you to sign up for these free sessions. Stay tuned for more details on how to sign up.

    Thanks!

    The InfoPath team.

  • Microsoft InfoPath 2010

    Introduction to Sandboxed Solutions - Sort data in repeating tables using managed code

    • 10 Comments
    Hi. My name is Phil Newman and I'm a program manager on the InfoPath team. In this post, I'd like to introduce you to one of my favourite new features in InfoPath 2010 - Sandboxed Solutions. 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.

    In this short video demo, I show how you can add the ability to sort repeating tables in your forms using code.  I use picture buttons in the heading of the repeating table to trigger the code which sorts the table based on the values in the columns. 

    Get Microsoft Silverlight

    About the Code

    In a nutshell, the code puts the XML from the repeating table into an array, sorts the array using built-in .Net functionality, and then writes back into the XML to update the table.

    //Sorts a repeating table.  Takes the parent group node and the index of the column to sort by.

    private void SortTable(string xpathToSort, int columnToSortBy)

    {

    //get the values in an array

    string[][] ValuesToSort = GetRepeatingTableValues(xpathToSort);

    //sort the array

    Array.Sort(ValuesToSort, new StringArrayComparer(columnToSortBy));

    //write the values back to the xml

    SetRepeatingTableValues(xpathToSort, ValuesToSort);

    }

    //Takes an array of arrays and inserts it into a repeating table

    //Assumes that the array and table are the same size

    private void SetRepeatingTableValues(string xpathToSet, string[][] tableValues)

    {

    //Create a navigator on main node supplied in the parameters

    XPathNavigator mainGroup = this.CreateNavigator().SelectSingleNode(xpathToSet, this.NamespaceManager);

    //Clone the first child node of the main navigator and populate it with data

    XPathNodeIterator tableRows = mainGroup.SelectChildren(XPathNodeType.Element);

               

    //iterate through the existing XML and update the values from the sorted array

    for (int i = 0; i < tableValues.Length; i++)

    {

    tableRows.MoveNext();

    XPathNodeIterator thisRow = tableRows.Current.SelectChildren(XPathNodeType.Element);

    for (int j = 0; j < tableValues[0].Length; j++)

    {

    thisRow.MoveNext();

    thisRow.Current.InnerXml = tableValues[i][j];

    }

    }

    }

    //Returns an array of arrays of strings representing the values in a repeating table

    private string[][] GetRepeatingTableValues(string xpathToGet)

    {

    XPathNavigator myNav = this.CreateNavigator();

    int rows, cols;

    XPathNodeIterator tableNodes;

    //figure out the dimensions of the table

    tableNodes = myNav.SelectSingleNode(xpathToGet, this.NamespaceManager).SelectChildren(XPathNodeType.Element);

                rows = tableNodes.Count;

               

    //move to the first row to count the columns

    tableNodes.MoveNext();

    cols = tableNodes.Current.SelectChildren(XPathNodeType.Element).Count;

    //create an array to store the values

    string[][] tableValues = new string[rows][];

    //get all the rows in the table

    tableNodes = myNav.SelectSingleNode(xpathToGet, this.NamespaceManager).SelectChildren(XPathNodeType.Element);

    //iterate through the rows and write the inner xml of each element in each row to the array

    for (int i = 0; i < rows; i++)

    {

    tableNodes.MoveNext();

    XPathNodeIterator childNodes = tableNodes.Current.SelectChildren(XPathNodeType.Element);

    string[] rowValues = new string[cols];

    for (int j = 0; j < cols; j++)

    {

    childNodes.MoveNext();

    rowValues[j] = childNodes.Current.InnerXml;

    }

    tableValues[i] = rowValues;

    }

    return tableValues;

    }

    //Comparison implementation for array or arrays

    class StringArrayComparer : IComparer

    {

    private int iColumn;

    public StringArrayComparer(int iColumn)

    {

    this.iColumn = iColumn;

    }

    int IComparer.Compare(Object x, Object y)

    {

    string[] xAsString = (string[])x;

    string[] yAsString = (string[])y;

    return xAsString[iColumn].CompareTo(yAsString[iColumn]);

    }

    }

    Requirements for publishing your forms with code as Sandboxed solutions:

    • The Sandboxed code service need to be enabled on the farm
    • You must be a site collection administrator on the site collection you’re publishing to
    • Your form must be domain trust
    • Your form template must be an InfoPath 2010 template
    • InfoPath 2007 form code needs to be upgraded to InfoPath 2010 form code

    Complete sandboxed solution documentation is available here.  Note that InfoPath takes care of packaging and activating the solution, all you need to do is publish your form to a document library or as a site content type.

    I look forward to hearing your comments about this new feature. Let me know what you think!

    Phil

  • Microsoft InfoPath 2010

    Manage data in your SharePoint Lists using the InfoPath Form Web Part

    • 3 Comments

    One of the powerful new features in InfoPath 2010 is the InfoPath Form Web Part.

    This is the 1st in a series of videos where we will show how to use the InfoPath Form Web Part to create rich mashups on portal pages in SharePoint, without writing a single line of code. In this video, Nick Dallett, a program manager lead on the InfoPath team, will demo two simple scenarios for managing data in your SharePoint lists using the InfoPath Form Web Part.

     

    Get Microsoft Silverlight

    Enjoy!

  • Microsoft InfoPath 2010

    Manage data in your SharePoint Lists using the InfoPath Form Web Part

    • 2 Comments

    One of the powerful new features in InfoPath 2010 is the InfoPath Form Web Part.

    This is the 1st in a series of videos where we will show how to use the InfoPath Form Web Part to create rich mashups on portal pages in SharePoint, without writing a single line of code. In this video, Nick Dallett, a program manager lead on the InfoPath team, will demo two simple scenarios for managing data in your SharePoint lists using the InfoPath Form Web Part.

     

    Get Microsoft Silverlight

    Enjoy!

  • Microsoft InfoPath 2010

    Create tabbed navigation using picture button controls

    • 9 Comments

    In the 2nd installment of our "5 for Forms" video demo series, Charlie Han, a program manager intern on the InfoPath team shows how you can use our new picture button control to create tabs to more easily navigate your forms.


    Get Microsoft Silverlight

    (There are additional steps required to create tabs in display views. Click here to find out more.)

    Enjoy!

  • Microsoft InfoPath 2010

    Customize a SharePoint List Form using InfoPath 2010

    • 29 Comments

    Today sees the launch of our new "5 for forms" video demo series. In this series, we will demo a cool new InfoPath 2010 feature or scenario in less than 5 minutes.

    In the 1st video of the series, Daniel Broekman, a program manager on the InfoPath team will show you how you can customize a SharePoint list form with just a few clicks:

    Get Microsoft Silverlight

    We will post the next video in the series "Create tabs using Picture buttons"  after the holidays on January 7th.

    Enjoy!

Page 2 of 12 (298 items) 12345»