Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

  • Microsoft InfoPath 2010

    Compatibility between InfoPath 2003, 2007, and Forms Server

    Ask and ye shall receive. Here's a short summary of how to think about compatibility when designing form templates in InfoPath 2007.
    1. InfoPath 2003 forms will work as-is in 2007
    Your existing forms should work. Period. If you find something that doesn't work, please leave a comment so we can get that bug fixed.
    2. InfoPath 2007 can save as InfoPath 2003 forms
    Most features actually work in 2003, we just made 2007 the default to be forward-looking. If you plan to design all your forms to be compatible with InfoPath 2003, you can change the default in the Options dialog off the Tools menu:
    You can also save individual forms as the file type 2003:
    When you save a file for InfoPath 2003, we automatically check this box in Form Options:
    So that the design checker will show you compatibility issues:
    You can get more info on each issue by clicking it, and then fix it appropriately. Forms with "Messages" will successfully save for 2003, but forms with "Errors" cannot be saved for 2003 until all the errors have been fixed.
    3. InfoPath 2003 forms can also work on the Forms Server
    If you have the InfoPath 2003 client rolled out to your desktops, and also have the Forms Server, then you can create forms that will open in the browser for people without any copy of InfoPath, but open in the client for those with InfoPath 2003 (and 2007, see point 1 above).
    First, follow the steps above to save your form to be compatible with InfoPath 2003. Then check this box in Form Options to make the form browser-compatible:
    Now you can fix any remaining issues shown by the design checker, and publish the form to Forms Server the same as any other browser-enabled form.
    Hope that helps,
  • Microsoft InfoPath 2010

    Getting the XPath without straining your brain

    Yesterday I talked about using System.Xml in the new object model. My code examples included a key part of the InfoPath programming model: looking up fields in the data source using XPath so that you can set and get values.
    Unfortunately, figuring out the absolute XPath to a field can be a pain.
    Fortunately, we've made that easy in InfoPath 2007.
    Here's how
    Right click the field in the Data Source task pane and click Copy XPath
    Now you can paste the XPath into your code and be on your merry way.
    Hope that helps,
  • Microsoft InfoPath 2010

    "Design Once" and the new InfoPath 2007 Object Model

    One of the main design principles for InfoPath 2007 and Forms Services 2007 is that you can create your form once, write code for it once, build and publish it once, and then have it work in both the browser and the client. We call this Design Once.
    To make this possible for form templates with code, we created a new object model that works on both the client and the server, so that the exact same assembly can work in both places. This is similar to what the Compact .NET Framework provides for mobile devices, where you can write a WinForm app that works on both the desktop and a Windows Mobile smartphone. Using the InfoPath object model you can write code for your form that will run the same way both on client, when opened in InfoPath, and on the server, when opened in the browser.
    Getting started with System.Xml
    If you've written code for InfoPath 2003, then you're used to writing code against the MSXML-based object model. For example, you might read and write a field's value like this in C# with the old object model:
    string xpath = "/my:myFields/my:field1";
    IXMLDOMNode field1 = thisXDocument.DOM.selectSingleNode(xpath);
    string oldValue = field1.text; // Read
    field1.text = "New Value";     // Write
    Here's how to do the same thing using the new object model:
    string xpath = "/my:myFields/my:field1";
    XPathNavigator field1 = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
    string oldValue = field1.Value; // Read
    field1.SetValue(“New Value”);   // Write
    If we break that down, we see the following mappings:
    InfoPath 2003 OM
    InfoPath 2007 OM
    Read field1.text
    Read field1.Value
    Set field1.text
    Set using field1.SetValue()
    Compatibility: Using the old OM in InfoPath 2007
    InfoPath continues to open forms that used the old object model, so you don't have to upgrade them just to use InfoPath 2007. That said, if you want a form to work in the browser, you will need to upgrade to the new object model. If you upgrade the code, InfoPath will automatically update the project format and rebind all your events, but you will need to convert your custom functions to the new OM.
    Compatibility: Using the new OM in InfoPath 2003
    The new object model won't work in InfoPath 2003, so we also allow you to create forms that use the old object model in InfoPath 2007. You can choose which version of the object model you want to use in Form Options in the Programmability category. 
  • Microsoft InfoPath 2010

    Goodbye WhoAmI! Hello userName()

    Anyone who's tried to get the username of the person filling out their form in InfoPath 2003 knows the WhoAmI web service. That was the only way to get the username without writing Visual Basic or C# managed code and using System.Environment.UserName.
    In InfoPath 2007 we built an easier way.
    Announcing a new formula function: userName()
    Now you can simply set the default value to the current form-filler's username. No code, no data connections, no custom web service. Just use the formula dialog and select the function from the category "All":
    To get a default value like this:
    If that's too easy for you, use it in script
    If you're writing script anyway, or if you need to check this value as part of a bigger algorithm and don't want to persist the username anywhere in the form, then you can also access this value in script:
    Of course, you can also use this in C# or Visual Basic, but you could always use System.Environment.UserName, so that's nothing new.
    Either way requires Domain Trust
    For security reasons, either approach will make your form require domain trust, so you'll need to publish the form to a shared location (like Windows SharePoint Services) for the function to work.
  • Microsoft InfoPath 2010

    Use Visual Studio to create InfoPath forms… without code

    Although the primary purpose of Visual Studio 2005 Tools for Office (InfoPath 2007 Support) is to add C# and Visual Basic code to your InfoPath form template, you can still take advantage of hosting InfoPath inside Visual Studio to design forms that don't have any code.
    When you create a new InfoPath form template project in Visual Studio, by default, it will be created with code enabled.  To obtain a form without code, you need to explicitly remove the code from the form by using the remove code button in the programming tab of the form options dialog.
    After clicking on this button, you might be confused to see that the code file is still present in the project.  Don’t worry about this.  When you build the project, the hosted designer will not add the output assemblies to the form template.
    How it works
    After a new project is created, the “enabled” attribute of the “managedCode” element in the manifest.xsf defaults to “yes”.  Clicking the remove code button sets this attribute to “no”.
    <xsf2:managedCode … enabled="no"></xsf2:managedCode>
    This attribute is set back to “yes” when you insert an event handler using the hosted InfoPath designer.
    After a success build, the output assemblies will only be included with the form template when this attribute is set to yes.
    - Gary
    Software Development Engineer
  • Microsoft InfoPath 2010

    Download the Beta!

    I'm super excited to announce Microsoft Office InfoPath 2007 Beta and Microsoft Office Forms Server 2007 Beta for browser-enabled forms, so you can install both of them today.
    After registering you'll get to select which products you want, which should include:
    • Microsoft® Office Professional Plus 2007 (includes InfoPath)
    • Microsoft® Office SharePoint® Server 2007 - Enterprise (includes Forms Services, which is also available standalone as Microsoft® Office Forms Server 2007. Both servers have 64-bit options.)
    All are available in English, French, Spanish, German, and Japanese, so tell your friends!
    - Ned and the whole exuberant InfoPath team
  • Microsoft InfoPath 2010

    Cool video on InfoPath in Outlook

    As part of getting everyone up to speed on Office 2007, and in preparation for the imminent release of the Beta, we've just posted some "Partner technical readiness training" videos.
    It includes a great one on using InfoPath in Outlook, so I thought I'd call it out:
    You can check out all the videos here:
  • Microsoft InfoPath 2010

    Best Practices for Rules

    My forms have a bad habit of accumulating more and more rules as I add more and more functionality over time, so I came up with a set of guidelines to keep those rules clean and orderly.
    Remember that there are four places to add rules
    1. On Button Click (in Properties dialog)
    2. When values change (in Controls and Data Source Properties)
    3. On Submit (in Submitting Forms dialog)
    4. On Load (in Form Options | Open and Save section)
    Give your rules names for the scenario they capture
    Good names will summarize their conditions/actions in a more friendly way: eg "Submit using multiple data connections", or "Cancel query if expenses too high".
    Group rules by condition, but separate actions without conditions
    If more than one action has the same condition, put them together so you can edit the condition only once. Otherwise, put each action in its own rule, so you can easily reorder them independently.
    Use "Stop processing rules" to save retyping conditions
    If there's a case where you don't want to run any of your rules, add a rule that checks that case. It doesn't need to have any actions, just check the box to stop processing rules and put the rule before any of the other rules that would also check that case. For example, if you want to skip some submit logic if the expenses in the form are less than 100, put that condition in its own rule before your submit logic, and just have it stop the rules.
    Use dialog messages to debug while developing
    Dialog messages are great for tracing your rules at runtime, but are usually jarring while filling out the form. If you have a condition message to show, use conditional formatting instead to hide/show a section/expression-box with the message. You can even make the message dynamic by having the expression box look up a value in the data source and setting that value from the rule.
    Know when to use calculated default values vs set a field's value
    The “Set a field’s value” action is best for values that only need to be set/copied once, or for values that are conditional. For values that need to update every time another field changes unconditionally, best to use a calculated default value. Good examples for rules:
    • Demo button that populates an entire form with sample data
    • Copying suggested values from a secondary data source that the users can edit afterward
    • Setting someone’s email address based on their name, but only if the email field is blank beforehand
    Got tips?
    If you've got your own best practices we'd love to hear them! Post a comment to share your insights with the whole community.
    - Ned
  • Microsoft InfoPath 2010

    Auto height for sections

    InfoPath forms are all about being dynamic, so it's important that the sections in your form grow and shrink appropriately. For example, if someone deletes an optional section from inside another section, the outer section should shrink accordingly.
    Of course, sections will grow/shrink by default after you insert them, but InfoPath will change it to a fixed size if you resize the section, since we don't want to disobey your command to be a specific size. So in the example above, the outer section will stay the same size even when the Notes section isn't there -- it will just have a bunch of white space in its place.
    The trick: Use "auto"
    If you resized a section by accident and want to return it to the default, just open its properties, switch to the "Size" tab, and type auto for the height. Now it will only be as big as it needs to be and never bigger.
    - Ned
  • Microsoft InfoPath 2010

    Moving fields in the data source

    As most folks figure out quickly, InfoPath doesn't support drag-and-drop of fields in the data source. There are a lot of technical reasons for this, and even a usability concern that people won't realize they can drag fields onto the form as controls if we also allowed them to drag fields around in the data source. But we've heard enough feedback that changing that has made it onto the long list of possible features for future releases. Keep the feedback coming!
    So how do you move fields groups in the data source?
    One way is to right-click the field or group and select "Move Up" or "Move Down". This is great for novices because it's discoverable, but it's a painful number of clicks if you're an expert who has to move a lot of fields in many forms.
    A trick for the keyboardist
    The fastest way to move a field or group a long distances is:
    1. Open the data source task pane
    2. Type the "F6" key
    3. Click tab until a field in the data source is highlighted in orange
    4. Use the Up/Down arrow keys to select the field you want to move
    5. Hold down the CTRL key and use the Up/Down arrow keys to move the field
    Note that this only moves the field in order, it won't move it as a child of a different group. To do that you still need to right-click the field and select "Move".
    Hope that helps!
  • Microsoft InfoPath 2010


    In my last post I covered how to make Wizard-like forms. This time I want to talk about another common practice for organizing all the fields in a form: grouping each set of fields onto a "tab" so the user can switch between the sets in whichever order they wish. While wizards are useful in forms with a clear flow, tabs are useful when the same form will be updated multiple times in different places.
    In Windows XP, tabs look like this (this screenshot's taken from InfoPath's View Properties dialog):
    InfoPath doesn't have a built-in Tab Control, but it's easy enough to build one using tables, buttons, and views, so let's do it!
    The basic idea
    Here's what to build:
    • Views for the contents of each tab
    • Table with shading to give the visual effect of tabs
    • Buttons for each tab with a rule that switches the view
    For example:
    Then when the user clicks "Details" they switch views to see this:
    How To, with tricks along the way
    1. Create all of your views (from the Views task pane)
      • Select the same color scheme for each view (use the Color Schemes task pane)
      • Use Background Color on the Format menu to make the background of each view the second color for the current color scheme (the second-darkest color at the top of the color picker)
    2. Insert a layout table (on the Insert menu, click Table)
      • Make it two rows high. The first row will be for the buttons, the second will be for the tab content.
      • Split the first row to make a cell for each view, plus one extra cell to take the remaining horizontal space.
    3. Insert a button into each cell (from the Controls task pane)
      • Add a rule to each button to switch to the corresponding view. Do this even for the current view's button.
      • Make the current "active" button Bold, so it stands out.
    4. Use borders and shading (on the Format menu)
      • Select all the buttons at once (hold down the Control key and click each one), then remove all borders and shading from the buttons (they're invisible except for their label!).
      • Select the entire table, then add borders inside and out using the first color in the color scheme (the darkest color).
      • Select the non-active cells and set their shading to the third lightest color of the color scheme.
      • Select the active cell and the content cell, and set their shading to white.
      • Select the active cell and remove the bottom border so it becomes connected to the content cell.
      • Select the right-most "extra" cell and remove the top and right border
    5. Copy the table to each view
      • Update the borders and shading to change the "active" cell for each view
      • Put all your fields for each tab in its content cell
    Getting fancy
    If the tabs above aren't pretty enough for your form, add some images inside a few more table cells around each button to provide rounded corners and other visual effects. It's more work, and requires some image editing, but with a little elbow grease you could get something as schmancy as this:
  • Microsoft InfoPath 2010

    WebCast Reminder: Developing Office InfoPath 2007 Forms

    Hello all,

    I want to thank those of you who attended last week's WebCast. We had a few technical issues that prevented us from completing the demos so we will likely present the WebCast again sometime in the future.  Monday, we'll be holding our third and final (for now) WebCast about InfoPath 2007. I hope you will be able to attend.

    Developing InfoPath Forms for Office InfoPath 2007
    Time: Monday, April 24, 2006 10:00 AM - 11:00 AM (PST)
    Presenter: Nima Mirzad, Program Manager - InfoPath
    This WebCast presents an overview of Microsoft Office InfoPath 2007 programmability features including the managed object model, template parts, and provisions for third-party hosting. We also discuss techniques for using Microsoft Visual Studio 2005 Tools for Applications (VSTA) and Microsoft Visual Studio 2005 Tools for the Microsoft Office System (VSTO) to develop Office InfoPath 2007 forms.

    Scott Roberts
    Software Design Engineering Lead
    Microsoft Office InfoPath
  • Microsoft InfoPath 2010

    Wizards (and we're not talking Harry Potter)

    I just got back from some customer visits in Washington DC (governments tend to have a lot of forms…) and a common design pattern came up a few times: creating wizard-like forms. Since InfoPath provides all the built in tools to do this, without any fancy XPaths or code, I thought it would be fun to blog about here.
    Basic wizard
    Let's say you have a form that would be easier to fill out if folks could focus on one section at a time in a specific order. You can provide that experience by putting each section in its own view, and adding Back/Next buttons to navigate between them.
    1. Open you form in design mode
    2. Open the Views task pane
    3. Click Add New View for each section in your form
    4. Copy and paste each section to its own view
    5. Open the Controls task pane
    6. Insert two Buttons
    7. Double click each button to open Button Properties
    8. Change the label for each button to "<< Back" or "Next >>"
    9. Click Rules to open the Rules dialog
    10. Click Add to add a rules
    11. Click Add Action to add an action
    12. For the Action, select Switch Views
    13. Select the view to switch to
    14. Copy and paste your button pairs to each view and update the rules to switch to different views.
    You can also provide this experience by adding Conditional Formatting to each section and hiding all sections that don't currently apply, but that can be cumbersome to design since the view can get so big, and I find it harder to manage the flow.
    Conditional Wizard
    InfoPath forms are dynamic, and wizard forms are no different. A common pattern is changing what data you collect based on what they selected earlier on. For example, it's tax time, so if I'm filling out a 1040 and select the option button to file as a single, I can skip the step that would ask me about dependents. You can get this in your form by adding a condition to the rule on your "Next" button, and adding a different rule for each view they could jump to.
    Some wizard pointers
    • Keep it simple. Try to minimize the number of controls on each page of the wizard. In fact, if you can ask for only one piece of information on a given page, your users will thank you. That said, if there is related data, keeping all of it on one page can be easier than having to skip back and forth.
    • Make it pretty. One of the benefits of a wizard is that you're not trying to cram all that data onto one page, so you have room to throw a graphic on the left in addition to a nice header. You can also wrap everything in a table to make sure the Next/Back buttons don't jump around. Eye candy for all!
    • Share where you are. If the wizard isn't conditional, leave the views on the View menu so people can quickly jump around if they want, and see how far they have to go. If the wizard is conditional so you don't want people jumping to the wrong pages, you can hide the views from the View menu using View Properties, but replace it with a chart at the top of each page to let them know how far they have to go. A simple text saying "25% complete" can go a long way.
    • Know when you're done. Presumably the last page of the wizard will submit the data. It's a nice touch to provide a summary of the data they've entered so far, and change the label on the "Next" button to "Finish" or even just "Submit".
    If you have any more tips on creating wizard forms, our team and the rest of the InfoPath community would love to hear them, so feel free to comment!
  • Microsoft InfoPath 2010

    WebCast Reminder: Developing Rich Client and Browser Forms

    I want to thank those of you who attended last week’s WebCast. It was a big success.  Tomorrow, we’ll be holding our second WebCast about InfoPath 2007. I hope you will be able to attend.
    Developing, Deploying, and Hosting Rich Client and Browser Forms for Microsoft Office InfoPath 2007
    Time: Tuesday, April 18, 2006 12:00 PM – 1:00 PM (PST)
    Presenter: Pradeep Rasam, Program Manager - InfoPath
    Were you aware that you can design Microsoft Office InfoPath 2007 forms for both the rich client and the browser in a single step? This webcast presents the design-once process for InfoPath 2007, and covers debugging, deployment, and improving the performance and scalability of forms. Find out how to host the InfoPath rich client in other applications, and how to tightly integrate InfoPath 2007 forms into Web pages. We also discuss best practices for using the hosted form control to build powerful but easy-to-use solutions.

    - Scott
  • Microsoft InfoPath 2010

    Check if form is new using roles, not code

    Ever want to add conditional formatting or special rules that only fire if your form was just created?
    For example, you want to show one view by default when someone creates a new expense report, but you want show a summary view for everyone else who opens the form.
    Here's how.
    Click on Tools, then User Roles, and use the dialog to add two roles:
    • New Form: Check the checkbox for "initiator" (don’t set any other properties) This role will apply for new forms only.
    • Old Form: Set this one as the "default" in this list
    You'll get something like this in the dialog:
    Now you've got roles to detect whether the user just created the form or is opening it later on, so you can use that information in Rules, Data Validation, Conditional Formatting, even Filters. Just go to the place you want to be conditional, then pick User's Current Role in the first dropdown of the condition, and pick the role you want to test for in the third dropdown (New Form or Old Form).
    You'll get something like this:
    Now when someone opens the form, you'll know if they just created it or are coming back later, and can make your form dynamic accordingly. It doesn't make sense for most forms, but like all the tricks in the blog, I hope this trick helps you make quick progress when the need arises.
    And there you have it. A little tip for the week.
    - Ned
  • Microsoft InfoPath 2010

    Webcast Reminder: New Features in Office InfoPath 2007

    Hi all,

    This is just a reminder that on Tuesday, Gray Knowlton will present the first in our three-part WebCast series introducing InfoPath 2007.  I hope you will join us.

    New Features in Office InfoPath 2007
    Time: Tuesday, April 11, 2006 12:00 PM - 1:00 PM (PST)
    Presenter: Gray Knowlton, SR. Product Manager - Office

    This webcast presents an overview of the new features in Microsoft Office InfoPath 2007 and InfoPath Forms Services. Join us to learn how you can use InfoPath 2007 to automate and extend business processes by utilizing XML and integration standards to connect electronic forms to virtually any application or system.

    Scott Roberts
    Software Design Engineering Lead
  • Microsoft InfoPath 2010

    Email Submit "To" line (loops in formulas)

    Everyone likes InfoPath's email data connection because it lets you collect forms using email only, no other infrastructure required (no need for Windows SharePoint Services, SQL Server, or even a file share). We've built even more Outlook integration in InfoPath 2007 Beta, but since most of you don't have that yet, let me share a tip that will work in both InfoPath 2003 and 2007.
    The basics: Single dynamic email address
    As your probably know, the To and CC line of the email data connection can come from a textbox in the form by using a formula. To do that, just use the Fx button next to the To line in the data connection wizard:
    The trick: Multiple email addresses from repeating controls
    Some forms have a list of names they want to send to, but the simple formula above won't work for that.
    For example, consider a repeating table that looks like this:
    With this data source (note that "person" is repeating):
    So you want to produce this semicolon-separated list of e-mails:
    A good instinct is to use the "concat" function, but unfortunately that only works on the first element in a repeating structure.
    So then comes the team insight: Our "eval" function returns a list of nodes which actually share an anonymous parent. That means you can use one eval functions to create a list of the email addresses, then wrap it in another eval function that gets the parent of that list.
    Voila, here's the formula to solve the problem:
    eval(eval(person, "concat(my:email, ';')"), "..")
    (Note that "person" can be inserted from the data source, but "my:email" needs to be typed by hand or you'll get an error.)
    For the curious: Here's how it's done
    Let's break down that XPath formula from the inside out:
    • "concat(my:email, ';')" - Adds a semicolon to each email address.
    • eval(person, "concat(my:email, ';')") - Loops through each person to create a list of email addresses
    • eval(eval(person, "concat(my:email, ';')"), "..") - Gets the anonymous parent of the email addresses, and converts them to a string.
    So the end result returns the contents of that anonymous parent, which is a series of semicolon-delimited email addresses. Phew!
    In summary
    We are using two tricks here:
    • The fields returned by eval() all have the same anonymous parent (feature of InfoPath's function)
    • The string value of a parent is the concatenation of all its children (W3C spec’ed)
    - David Airapetyan (Software Design Engineer) and Ned
  • Microsoft InfoPath 2010

    Fun for the Whole Office Family

    Most of this blog focuses on advanced tips and tricks for InfoPath, but I'd hate it if that left you thinking InfoPath was a developer-only tool. We're part of the Office family, and we'd like to think we act like it, so let me call out a brand new site our product managers just put together that covers InfoPath 2007's out-of-the-box easy-to-use features you'd expect from an Office product.
    The screenshot above is from a quick demo on the site that shows importing a paper based Word form into InfoPath, routing it through email and the browser (shown above), and exporting the results from Outlook into Excel for analysis. It's an example of how much can be done without using the bag of tricks this blog's all about. Hopefully it helps you see how your organization can use InfoPath to make all those pesky business processes run smoother without a bunch of IT legwork. Better yet, it might even help erase that cringe reaction to the term "business process."
    But of course you don't need to read a blog by the InfoPath creators to learn how to use our powerful built-in features, so we'll keep posting those advanced tricks, don't you worry.
    - Ned
  • Microsoft InfoPath 2010

    MSDN WebCasts: InfoPath 2007

    In April, the InfoPath team will present three MSDN WebCasts introducing the new features available in InfoPath 2007. These three presentations will provide a high-level overview of InfoPath 2007. In the future, we will offer more detailed presentations that dive down into individual features of InfoPath 2007.
    We hope you will join us for the first three InfoPath 2007 presentations. Here is more information about the first three talks including the schedule.
    New Features in Office InfoPath 2007
    Time: Tuesday, April 11, 2006 12:00 PM – 1:00 PM (PST)
    Presenter: Gray Knowlton, SR. Product Manager - Office
    Description: This webcast presents an overview of the new features in Microsoft Office InfoPath 2007 and InfoPath Forms Services. Join us to learn how you can use InfoPath 2007 to automate and extend business processes by utilizing XML and integration standards to connect electronic forms to virtually any application or system.
    Developing, Deploying, and Hosting Rich Client and Browser Forms for Microsoft Office InfoPath 2007
    Time: Tuesday, April 18, 2006 12:00 PM – 1:00 PM (PST)
    Presenter: Kalpita Deobhakta, Program Manager - InfoPath
    Description: Were you aware that you can design Microsoft Office InfoPath 2007 forms for both the rich client and the browser in a single step? This webcast presents the design-once process for InfoPath 2007, and covers debugging, deployment, and improving the performance and scalability of forms. Find out how to host the InfoPath rich client in other applications, and how to tightly integrate InfoPath 2007 forms into Web pages. We also discuss best practices for using the hosted form control to build powerful but easy-to-use solutions.
    Developing InfoPath Forms for Office InfoPath 2007
    Time: Monday, April 24, 2006 10:00 AM – 11:00 AM (PST)
    Presenter: Nima Mirzad, Program Manager - InfoPath
    Description: This webcast presents an overview of Microsoft Office InfoPath 2007 programmability features including the managed object model, template parts, and provisions for third-party hosting. We also discuss techniques for using Microsoft Visual Studio 2005 Tools for Applications (VSTA) and Microsoft Visual Studio 2005 Tools for the Microsoft Office System (VSTO) to develop Office InfoPath 2007 forms.
    Scott Roberts
    Software Design Engineering Lead
    Microsoft Office InfoPath
  • Microsoft InfoPath 2010

    Let the blogging begin

    We've been heads down working on the upcoming Beta and had to take a break from blogging. But now we're back and excited to share the ins and outs, tips and tricks, and best practices for getting the most out of Microsoft Office InfoPath 2003 and 2007 (Beta). We'll also post announcements for events like the Beta release, web casts, and conferences. 
    Be the go-to person for InfoPath solutions
    Sign up for the RSS feed if you want to speed up your InfoPath development time with nifty insights, workarounds, and head's up on lesser-known features. You can even read this blog in Outlook 2007 (Beta). If you can't keep up with the posts, come back to this blog as your reference library when you get stuck and need a quick out, or when you're looking to add some flare to your forms.
    But wait, there's more
    Be sure to check out these other InfoPath resources, also linked in the sidebar:
    • Office Online: Your one stop shop for tutorials, getting started material, and other help-related articles.
    • Developer Center: Got code? Go here to learn how to go above and beyond with your forms using managed code and script.
    So stay tuned for regular updates you can add to your bag of tricks for rapidly developing dynamic powerful InfoPath forms.
  • Microsoft InfoPath 2010

    Using InfoPath e-mail forms

    First I’d like to mention that, as part of a recent announcement, the product name for InfoPath “12” is Microsoft Office InfoPath 2007. This is the name I’ll be using from now on in my blog. In my first post I talk about the benefits of browser-enabled forms. I’d like to focus now on the InfoPath rich client and give you a sense of how it can streamline your daily work with InfoPath e-mail forms. If you are familiar with InfoPath SP1 you probably know that it already allows you to send forms as attachments in email. So why is “e-mail forms” a new feature in Office InfoPath 2007? Well, the limitation in InfoPath SP1 is that forms are just regular attachments and they are not integrated in your Outlook email environment. So in Office 2007 we’ve decided to make forms a first class item in Outlook. That means forms can now be viewed, edited, saved, and forwarded similar to email messages, meetings, or tasks. In addition, e-mail forms can leverage Outlook PIM features like categories and follow up to add a new dimension to your forms workflow. E-mail forms now have their own folder type and they even have their own icon J. This tighter integration makes it really easy to work with forms and to leverage all the structured information they provide without having to leave your familiar Outlook environment. Let’s walk thru a short scenario using InfoPath e-mail forms.
    Let’s assume I need to collect information about the computers used by my team. First I need to design a form template to collects this information. For our scenario, InfoPath ships out-of-the-box an Asset Tracking template, which I will use for this example. In order to be sent out safely in email, forms like Asset Tracking need to work only with data from within the form and can contain only declarative logic, no code. Because of these security restrictions we call such forms “restricted” forms. Once the template is completed, I need to deploy it using the Publishing Wizard and selecting the option “to a list of e-mail recipients”. I then need to specify the recipients, add an optional comment, and send out the form. The screenshot below shows the e-mail deployment of my Asset Tracking form:
    When a member of my team receives the form, she clicks “Reply”, which opens the form in InfoPath. She then fills out the computer information and sends the completed form back to me, as shown in the screenshot below. She has the choice to send me an editable XML form, which is the default, or to send back just a read-only view. She can also add a comment related to the form in the “Introduction” field. This comment is in fact metadata that travels with the forms. The same field can be used, for example, to ask her assistant to fill out the asset information for her and, for more complex forms, to give instructions on how to complete the form. Here is an example of a completed asset tracking form (In this case I’ve completed it as a team member and I’m sending it back to myself):
    Note that at design time I could include a submit button in the form. This will let my team members double-click on the form, edit it in InfoPath and then click “Submit” to send it back to me in e-mail, same as if they replied. However, “Submit” will validate the form and will enforce the return e-mail address. This helps if I need to implement a more formal workflow process using e-mail forms.
    Now I’m switching back to being the data collector. I’m expecting to receive a fairly large number of e-mail forms from my team and I want to be ready to process them. To this end, I’m setting up a new Outlook folder to collect the asset data. I right click on Mailbox and select “New Folder”. In the “New Folder” dialog I need to select the option “InfoPath Form Items”, which is new in Outlook 2007, and associates the folder with InfoPath forms. Here is the dialog that creates the “assets” folder for e-mail forms:
    Once I’ve created the folder, I can also create a rule that automatically routes incoming asset forms to this folder. This rule should refer to InfoPath forms, as shown in the Rules Wizard dialog below. Then I need to pick-up the specific form type out of the list of all the templates that have been cached on my local machine. For each incoming message, the rule will check if it is an e-mail form of type “asset tracking” and will route all the matching e-mails to the “assets” folder. 
    Note that forms can be stored in any Outlook folder. However dedicated forms folders will create by default a new e-mail form based on the template associated with the folder. In addition those folders will allow property promotion, as explained below.
    When each form is saved into the “assets” folder, the properties that have been market for data promotion in the template are copied as Outlook properties. The forms in this folder can now be sorted and filtered based on their promoted properties, You may know how useful it is to take advantage of promoted properties in SharePoint form libraries. You can see at a glance the work progress captured in weekly status reports or the results of a team survey. The same experience is now also available on your local machine, using e-mail forms and form folders in Outlook. Like in SharePoint, the data stored in form folders can be aggregated and exported to Excel for further processing. Below is an example of asset forms with properties promoted in the “assets” folder:
    As you can see, in addition to using the properties promoted from forms, I can take advantage of other properties, like Categories and Flags that Outlook provides for all item, regardless of type. In the example above I’ve flagged the machines that need to be replaced, upgraded, or the new ones that have been purchased in the last quarter.
    When I get all the replies from my team, I will go ahead and process the data. As I mentioned before, the data is not in some collection of text e-mail messages that I need to read in order to extract information for my report. It is in a collection of structured forms that I can very easily process and extract the data to report on.
    My next step is to export the data to Excel. I select all the forms in the folder and then select the “Export to Excel” option from the toolbar. This option automatically generates a spreadsheet with all the data mapped from the forms into Excel. Note that the export to Excel is not limited to the promoted properties in my folder but rather to the entire XML of each form in the folder. Once I have all the data in Excel, I create a simple pivot table with the number of laptop, desktop, and lab machines for each functional team and then I chart the data using the new graphics engine. Here is the result of my data gathering scenario using the e-mail form for asset tracking: 
    When should you use e-mail forms?
    We’ve seen how I’ve used e-mail forms to gather asset information from my team. E-mail forms could also be used for many similar scenarios, often ad-hoc, in order to collect data quickly from a group of people, via e-mail. Examples are creating a survey for your department, gathering feedback from customer visits, or collaborating with your team on a status report. The common elements of these scenarios are:
    • The data needs to be structured – otherwise you’d just use regular e-mail
    • The data collection is done ad-hoc – there’s no need to set up a more formal process
    • You own the final results – it is ok for the final results to be collected in your own mailbox
    Once you have the replies, you could process them as needed and/or share the data with your team. In our example, I am the consumer of the collected information. I will export the data to Excel, review it, and order new hardware as necessary. For status report, the team lead will be assembling the report, then will publish it, and present it to the team.
    A broader scenario is using e-mail to make other forms available to your users. Your forms could be part of a formal team scenario like tracking weekly status, a department workflow solution, or an enterprise wide line-of-business application allowing every employee in the company to update benefits or to submit their performance reviews. In all these scenarios, the forms can be delivered, filled out, and submitted in Outlook. We will cover integrated scenarios for e-mail forms in a follow-up post.
    Finally an important benefit of e-mail forms is offline filling. As you may know, form templates are automatically downloaded on your machine on first use. Forms can also be installed as part of a client setup. Once you’ve used a form once on your machine, you can fill out any similar forms offline. To make things even simpler, “restricted” form templates can be included in the same message with the actual e-mail form. A user can download the form in Outlook, open it, fill it out, and submit it back as e-mail form. An additional benefit here is that you can complete the form offline, submit it, and be done. The form will be stored in the Outlook Outbox folder and will be sent out automatically next time Outlook connects to your e-mail server.
    I hope I’ve been able to give you a sense of the value of InfoPath e-mail forms as first class items in Outlook and get you interested in trying them out in Office 2007. I’ll follow up shortly with other posts on new InfoPath features. Stay tuned! I’d also love to hear your thoughts and feedback.
    Tudor Toma
    Group Program Manager
  • Microsoft InfoPath 2010

    Tudor's overview of InfoPath browser-based forms

    This is my first blog on InfoPath 12 so please allow me to introduce myself. I’ve started in Microsoft as a developer on FoxPro. If anyone still remembers the database container and the client connectivity, those are features I contributed to many years ago. Later on I moved to program management and worked on the` data access stack in the early days of odbc, oledb, and ado. I’ve always been passionate with data processing so, about five years ago, I’ve been super excited to participate in jump-starting an incubation project for authoring generic XML. That project grew into InfoPath 2003, then SP1, and now the brand new InfoPath v2 in Office 12.
    After we shipped InfoPath 2003, we’ve surveyed InfoPath users and asked them for the most important feature round-outs they’d like to see in the product. In SP1 we’ve addressed 9 out of the top 10 requests. However we couldn’t address request #1 which was filling out InfoPath forms in the browser. This feature is now available in InfoPath 12! I think the best use of my first post on InfoPath 12 is to give you an insight into browser forms and share some of my thoughts on this feature.
    One goal for InfoPath 12 has been to let users design a form once for both the rich client and the browser. Informally we call this feature “design once”. This way the same form template basically addresses scenarios that require the richness of the InfoPath client and scenarios for browser form filling, with zero client footprint. Choosing between rich and reach forms used to be a dividing requirement for form developers. Now InfoPath provides what I think is a very elegant solution for it. In InfoPath 12 users building forms only need to check the “Web browser enabled” checkbox to create a “design once” form. (Yes, I will talk in a follow up post about the “Template Part” option :-)).
    Our functionality goal for browser forms has been to provide a level of validation for the data entered via the browser than matches that of the data entered in the InfoPath rich client. In other words, for “design once” forms, the xml schema validation, rules, conditional formatting, and business logic apply the same way for both rich and browser forms. InfoPath makes sure that the quality of the data submitted by a form is the same, regardless of the client that has been used to fill it out.
    The layout is very similar between the rich and the browser version of a form. As you may know, the InfoPath client uses html for the form layout, which makes it very similar to the same form rendered in the browser. I’ve included below a Loan Application form rendered in InfoPath and in IE. Notice the same in-doc UI for repeating items, the same controls, and the same table layout, which makes the forms virtually identical. One difference is the spellchecking in the InfoPath client, which represents an improvement over the browser form.
    Here is the same Loan Application form rendered in Internet Explorer:
    The value of zero footprint forms is not complete if they are not available virtually on any machine and on any platform. InfoPath 12 delivers ubiquity of form filling. Users are able to fill out forms in current versions of IE, Firefox, Safari, and Netscape. The form functionality and validation remains the same across all browsers. We’ve worked hard to provide true ubiquity of form filling in order to allow all users to participate in business-to-citizen scenarios such as banking, insurance, healthcare as well as in many government-to-citizen scenarios. I’ve included another version of the Loan form below, this time rendered in Firefox:
    In addition to the browsers mentioned above, we are also providing InfoPath forms for mobile devices. The set of controls available for mobile browsers is more limited. However we expect to run most forms that are appropriate to being filled out on mobile devices. Here is the same Loan form as above rendered on a PDA and on a smart phone:
    I feel I’ve added a lot of screenshots for a first blog on InfoPath. To my defense, I’ve tried to make a visual statement on the ubiquity of browser forms and on their high layout fidelity in different browsers. I hope you found them valuable.
    Finally, I wanted to mention a very important point. The first reaction of some customers when we show them the browser forms is to question the necessity of using the rich client: “If our users can access forms in the browser, with zero footprint, why would they ever need to run rich forms in InfoPath?” This question makes me think of my personal experience with Outlook Web Access. For me it provides a great experience for a browser mail client but I would never use it if I could work in Outlook. The rich functionality and offline caching are features I would never give up. I think InfoPath has a similar value proposition. It provides a smooth, self-contained form filling experience, with no server roundtrips. It gives you the ability to work on your forms offline. It also integrates with Outlook allowing you to route forms in email and store them in form-enabled folders, which become your local version of SharePoint form libraries. In addition, there are a few features, such as ActiveX controls and form rights management that work only in the InfoPath client.
    This is my short dive into InfoPath 12 browser-based forms. I know I’ve mentioned a number of features without giving any details but I wanted to keep my posting scoped. I will follow up shortly with more product information. Please send me your comments and help me focus my upcoming posts on areas of most interest to you. Thanks and stay tuned! 
    Tudor Toma
    Group Program Manager
  • Microsoft InfoPath 2010

    Microsoft Office InfoPath 2003 Toolkit for Visual Studio 2005


    Visual Studio 2005, SQL Server 2005, and BizTalk 2006 all launched on Monday.

    That means the Microsoft Office InfoPath 2003 Toolkit for Visual Studio 2005 is now available as part of the Visual Studio 2005 Tools for the Microsoft Office System.

    To install the Toolkit, run setup from the CD labeled "Microsoft Office InfoPath 2003 Toolkit for Visual Studio 2005" that is included with the Visual Studio 2005 Tools for Office package, or from the separate related download for MSDN Subscribers.

    Find out more here:


  • Microsoft InfoPath 2010

    InfoPath 2003 Toolkit for Visual Studio 2005 Beta 2


    The InfoPath 2003 Toolkit for Visual Studio .NET 2003 has been updated for Visual Studio 2005 and is included as a separate install in Visual Studio Tools for Office 2005 Beta 2. It will automatically upgrade Visual Studio .NET 2003 projects so you can leverage your existing work.

    “Support for InfoPath means you can add business logic to your form using managed code instead of script. Managed code allows you to use the Microsoft .NET Framework common language runtime (CLR) to write code in Microsoft Visual C# or Microsoft Visual Basic, and to make calls into the .NET Framework class library for advanced tasks such as digital signature processing and encryption/decryption. Visual Studio integration includes F1 Help support, full-featured debugging, and Microsoft IntelliSense in the code editor. IntelliSense provides statement completion, members lists, and inline parameter information on the InfoPath object model.”

    Here’s how to get it:

    MSDN Subscribers

    Log into MSDN Subscriber Downloads at

    On left hand side go to:

    Developer Tools / Visual Studio 2005 / Visual Studio 2005 Beta 2 / English / Office InfoPath 2003 Toolkit for Visual Studio 2005

    Non-MSDN Subscribers

    Go here:

    Click “Order Visual Studio Beta 2” to get it on CD while supplies last.

    The InfoPath Toolkit will be on its own CD in that set.

  • Microsoft InfoPath 2010

    TechEd Source Code


    Some people were using digital cameras to capture the source code from our "InfoPath: Developing Forms with Managed Code" sessions, but we want to make it easier than that!

    So here's the code Ned Friend used in the TechEd Europe version of the presentation (David Gerhardt used similar code in his USA version of the talk in Orlando):

    DISCLAIMER: This code is designed to be short and sweet for demo purposes only. IT IS NOT BEST PRACTICES NOR READY FOR PRODUCTION.

    using System;

    using Microsoft.Office.Interop.InfoPath.SemiTrust;

    // Add .NET reference: System.Xml

    using System.Xml;

    using System.Xml.Xsl;

    using System.Security.Cryptography;

    using System.IO;

    // Add COM reference: Microsoft Word 11.0 Object Library

    using Word = Microsoft.Office.Interop.Word;


    // Office integration attribute. Identifies the startup class for the form. Do not

    // modify.

    [assembly: System.ComponentModel.DescriptionAttribute("InfoPathStartupClass, Version=1.0, Class=StatusReport.StatusReport")]

    namespace StatusReport


    // The namespace prefixes defined in this attribute must remain synchronized with

    // those in the form definition file (.xsf).

        [InfoPathNamespace("xmlns:soapenc=\"\" xmlns:xdUtil=\"\" xmlns:xdXDocument=\"\" xmlns:tm=\"\" xmlns:dfs=\"\" xmlns:xhtml=\"\" xmlns:xd=\"\" xmlns:soap=\"\" xmlns:tns=\"\" xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" xmlns:http=\"\" xmlns:xdMath=\"\" xmlns:xsf=\"\" xmlns:mime=\"\" xmlns:wsdl=\"\" xmlns:my=\"\" xmlns:xdDate=\"\" xmlns:xsi=\"\"")]

        public class StatusReport


            private XDocument thisXDocument;

            private Application thisApplication;

            // For encryption/decryption

            private Rijndael key = new RijndaelManaged();

            public void _Startup(Application app, XDocument doc)


                thisXDocument = doc;

                thisApplication = app;

                // You can add additional initialization code here.


            public void _Shutdown()



            // The following function handler is created by Microsoft Office InfoPath. Do not

            // modify the type or number of arguments.

            [InfoPathEventHandler(EventType = InfoPathEventType.OnLoad)]

            public void OnLoad(DocReturnEvent e)


                // Set the username

                IXMLDOMNode userName =


                if (userName.text == String.Empty)


                    userName.text = Environment.UserName;


                // Load key information

                IXMLDOMNode keyNode = thisXDocument.DOM.selectSingleNode("/my:status/my:key");

                IXMLDOMNode ivNode = thisXDocument.DOM.selectSingleNode("/my:status/my:iv");

                byte[] keyBytes = Convert.FromBase64String(keyNode.text);

                byte[] ivBytes = Convert.FromBase64String(ivNode.text);

                // Decrypting the project name

                MemoryStream ms = new MemoryStream();

                CryptoStream csRijndael =

                    new CryptoStream(ms, key.CreateDecryptor(keyBytes, ivBytes), CryptoStreamMode.Write);

                IXMLDOMNode projectNode =


                byte[] projectBytes = Convert.FromBase64String(projectNode.text);

                csRijndael.Write(projectBytes, 0, (int)projectBytes.Length);


                string projectName =

                    System.Text.Encoding.Unicode.GetString(ms.GetBuffer(), 0, (int)ms.Length);

                projectNode.text = projectName;


            // The following function handler is created by Microsoft Office InfoPath. Do not

            // modify the type or number of arguments.

            [InfoPathEventHandler(MatchPath = "/my:status/my:date", EventType = InfoPathEventType.OnValidate)]

            public void date_OnValidate(DataDOMEvent e)


                // Custom data validation because InfoPath does not have functions for date arithmetic

                if (e.Operation == "Insert")




                        DateTime date = DateTime.Parse(e.NewValue.ToString());

                        if (date.CompareTo(DateTime.Today.AddDays(5)) > 0)


                            e.ReportError(e.Site, "Date cannot be more than 5 days away.",

                                                         false, null, 1, "modal");



                    catch (FormatException)


                        // Incorrectly formatted dates are handled automatically by InfoPath.




            // The following function handler is created by Microsoft Office InfoPath. Do not

            // modify the type or number of arguments.

            [InfoPathEventHandler(EventType = InfoPathEventType.OnSubmitRequest)]

            public void OnSubmitRequest(DocReturnEvent e)


                // If Online, submit using data adapter

                if (thisApplication.MachineOnlineState == XdMachineOnlineState.xdOnline)


                    WebServiceAdapter2 webServiceAdapter =




                // If Offline, save to cache



                    XmlDocument xmlDoc = new XmlDocument();

                    string now = DateTime.Now.ToString("yyyy-MM-dd");

                    xmlDoc.PreserveWhitespace = true;


                    xmlDoc.Save("C:\\TechEd2005\\Submit\\Form " + now + ".xml");


                e.ReturnStatus = true;


            // The following function handler is created by Microsoft Office InfoPath. Do not

            // modify the type or number of arguments.

            [InfoPathEventHandler(EventType = InfoPathEventType.OnSaveRequest)]

            public void OnSaveRequest(SaveEvent e)


                // Set up encryption streams

                MemoryStream ms = new MemoryStream();

                CryptoStream csBase64 =

                    new CryptoStream(ms, new ToBase64Transform(), CryptoStreamMode.Write);

                CryptoStream csRijndael =

                    new CryptoStream(csBase64, key.CreateEncryptor(), CryptoStreamMode.Write);

                // Encrypt project name

                IXMLDOMNode projectNode =


                byte[] projectBytes =


                csRijndael.Write(projectBytes, 0, (int)projectBytes.Length);


                string projectEncrypted =

                    System.Text.Encoding.ASCII.GetString(ms.GetBuffer(), 0, (int)ms.Length);

                // Save key information

                IXMLDOMNode keyNode = thisXDocument.DOM.selectSingleNode("/my:status/my:key");

                IXMLDOMNode ivNode = thisXDocument.DOM.selectSingleNode("/my:status/my:iv");

                keyNode.text = Convert.ToBase64String(key.Key);

                ivNode.text = Convert.ToBase64String(key.IV);

                // Save encrypted project name, then decrypt in view

                string projectOriginal = projectNode.text;

                projectNode.text = projectEncrypted;

                e.IsCancelled = e.PerformSaveOperation();

                projectNode.text = projectOriginal;


                e.ReturnStatus = true;


            // The following function handler is created by Microsoft Office InfoPath. Do not

            // modify the type or number of arguments.

            [InfoPathEventHandler(MatchPath = "ButtonGenerate", EventType = InfoPathEventType.OnClick)]

            public void ButtonGenerate_OnClick(DocActionEvent e)


                // This button converts the XML Form to a Word Document


                // Load the XSLT file from resources

                IXMLDOMDocument domDocument = thisXDocument.CreateDOM();


                XmlDocument xsltDocument = new XmlDocument();


                // Load the XML DOM into System.Xml

                XmlDocument infoPathDocument = new XmlDocument();


                // Apply the XSLT to the XML DOM

                XslCompiledTransform xslt = new XslCompiledTransform();


                XmlDocument outputDocument = new XmlDocument();

                System.Xml.XPath.XPathNavigator outputNavigator = outputDocument.CreateNavigator();

                using (XmlWriter writer = outputNavigator.AppendChild())


                    xslt.Transform(infoPathDocument, writer);


                // Instantiate Word with the new document

                object missing = System.Reflection.Missing.Value;

                Word.Application wordApplication = new Word.ApplicationClass();

                Word.Document oDoc = new Word.DocumentClass();

                oDoc = wordApplication.Documents.Add(ref missing, ref missing, ref missing, ref missing);

                wordApplication.Selection.Range.InsertXML(outputDocument.OuterXml, ref missing);

                wordApplication.Visible = true;




Page 8 of 12 (298 items) «678910»