Tips & Tricks for Developing InfoPath Solutions David Coe Application Development Consultant Microsoft Corporation
Agenda Choosing InfoPath (or not) Programming Models in InfoPath Developing a basic form Publishing Forms Directly Using Forms Services Advanced Forms The data’s there, now what? Programming against InfoPath forms (‘cause it’s just XML)
Audience People Interested in InfoPath Developers Administrators may find this a bit boring (or scary) But there’s some for you too Assume some experience with InfoPath, SharePoint, and Form Libraries Not a “how to” talk
What it’s Good for Simple or Complex User Input Nice for tracking threads, repeatable items Reviews, travel requests, task/time tracking Attaching documents to sheet InfoPath is XML, so a lot can be automated No programming needed for many forms
What it’s not Good at Difficult to save data beyond form (services are best option) Capturing history outside of specific document (ie, 12 months of reviews) Connection management can be admin burden for Forms Services
Sample Applications What do sample applications look like?
Sample Applications
Programming Models COM & Scripting Object Model JScript/VBScript (XDocument) InfoPath 2003-compatable Managed Code Object Model Not available for browser-based forms InfoPath 2007 Managed Code Object Model Subset available for browser-enabled forms InfoPath Managed Code External Automation Object Model
Developing a Basic Form Straight forward, no code, no repeating Easy to pick up
Developing a Basic Form Start from scratch Customize a sample Start from XML or web service
Basic Form
Publishing a Form Save your template Publish to SharePoint, , network share
Publishing the Form
Publishing to Forms Services Simply configure to display as web page Require administrative approval if: Form contains managed code Full Trust required Data connection needs to be managed Form is enabled for mobile display
Simple Publishing in Forms Services
Advanced Form Development An advanced form contains repeatable regions, complex relationships, code behind, etc. Starting from XML/XSD document
Advanced Form & Forms Services
What do I do with the Data? So you’ve captured all your user input … What do you do with it now? Whether the documents are in the file system or in SharePoint, you can parse them however you like
Two Samples Parsing data from the File System Parsing data from SharePoint
File System Sample All InfoPath documents reside on the file system XSD generator to generate XSD from InfoPath doc for use with XmlSerializer VSTO in Excel Excel loads and parses documents Generate pivot tables and charts
Excel Parsing InfoPath
SharePoint Sample InfoPath documents reside in Form Library Need to be able to parse the XML from the documents in the SharePoint library
SharePoint Sample Need: 1000s of opportunities across the district identified in SDPs How can we plan for all of these and try to have local resources handle the requests? Provide a steady burn over 12 month period to level out margin
How I Did It Small WinForms app SharePoint List Service / CAML to get URL of InfoPath docs Use WebClient DownloadString(url) method to get the XML from InfoPath Use XPath to parse the document Dump data into Excel document
What Else is Interesting It is possible to downgrade a form from MOSS/InfoPath 2007 to WSS/2003 Outside vendor developed form and site for my customer in MOSS/InfoPath My customer only had WSS and InfoPath 2003 so we needed to downgrade. Wasn’t that bad.
Additional Resources InfoPath Team Blog InfoPath Team Blog InfoPath Developer Portal InfoPath Developer Portal InfoPath 2007 Document: Developing InfoPath 2007 Managed-Code Solutions InfoPath 2007 Document: Developing InfoPath 2007 Managed-Code Solutions Guide to InfoPath 2007 Developer Documentation Guide to InfoPath 2007 Developer Documentation Microsoft Office InfoPath Portal Microsoft Office InfoPath Portal InfoPath 2007 Sample: Training Labs InfoPath 2007 Sample: Training Labs
© 2009 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.