CLI312 InfoPath: Developing Forms Using Managed Code Dan Green Paradigm Logic Checklist for Today Getting started Event handlers Offline reference data caching InfoPath Business Logic C# VB.NET Rules Formulas Data Validation Data Connections Conditional Formatting XML Schema Most Form Development Does Not Need Code Integrating InfoPath with Visual Studio Form Template And Project Visual Studio Project Form Data Source Code (CS, VB) Project Definition (*PROJ) Form Template Files .XML InfoPath Form Template (XSN) Publish / Preview Assemblies (DLL and PDB) Template Definition (XSF) Default Data (XML) Schema (XSD) Views (XSLT) User Fills Out Form Machine Setup Developers – To create the form: Microsoft Visual Studio .NET 2003 or VSTO 2005 Beta 2 Microsoft Office InfoPath 2003 SP1 InfoPath Toolkit for Visual Studio Visual Studio .NET 2003 http://www.microsoft.com/downloads/details.aspx?FamilyI d=7E9EBC57-E115-4CAC-9986A712E22879BB&displaylang=en VSTO 2005 Beta 2 MSDN subscribers: http://msdn.microsoft.com/subscriptions/ (download) Non-MSDN subscribers: http://lab.msdn.microsoft.com/vs2005/get/ (CD) End Users – To fill out the form: .NET Framework 1.1 or 2.0 Beta InfoPath 2003 SP1 Event Framework User Events Open OnLoad Event Handlers OnClick Edit OnBeforeChange OnValidate OnAfterChange Submit Close OnSubmitRequest C# VB.NET Form Editing Events XMLDOM status issues OnAfterChange(DataDOMEvent e) items item rate Event Handler Bubbling item hours hours Form Editing Events XMLDOM status issues Event Handler OnAfterChange(DataDOMEvent e) items Bubbling Bubbling hides source item rate item hours hours e.Site: The node attached to the event handler. e.Source: The node that caused the event. Working with Event Handlers Offline Submit And Cache Offline Submit OnSubmitRequest If online, submit using DataAdapter Else, save XML locally using IsolatedStorage OnLoad Swap each cached file with main DOM, and submit Example on MSDN: http://msdn.microsoft.com/library/enus/odc_ip2003_ta/html/odc_InfoPath_submitting_ forms.asp?frame=true Offline Cache of Secondary Data Sources OnLoad If online, update cache with new local copies Else, use cached copies instead Offline reference data caching Word Document Creation InfoPath to Microsoft Office Word Wizard Good starting point For advanced scenarios Add XSLT as a resource to the form Transform the form data source Save transform results to an XmlDocument object Insert XmlDocument object into Word Example: http://blogs.3sharp.com/Blog/davidg/archive/2004/12/17/183 .aspx Session Summary Getting started Event handlers Offline reference data caching Resources Home: http://office.microsoft.com/infopath MSDN: http://msdn.microsoft.com/infopath InfoPath Team Blog: http://blogs.msdn.com/infopath 3Sharp Team Blog: http://blogs.3sharp.com/Blog Newsgroup: microsoft.public.infopath We invite you to participate in our online evaluation on CommNet, accessible Friday only If you choose to complete the evaluation online, there is no need to complete the paper evaluation © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.