Random musings and an Infopath tip

Random musings…  I have had too much sugar today and too little sleep last night, so my brain is a little fried.  Consider yourself warned 🙂 My current gig is for a hospital.  Every evening when I leave the parking lot, the automated toll machine remarks “thank you and please come again”.  Is that really the best farewell they…

1

The Infopath presentation to the .Net Architects User Group Rocked!

Last night was lots of fun. I delivered a 2 hour InfoPath presentation to the Israeli .Net Architects user group. This was my first time in front of this particular UG, and they are a pretty sharp bunch who were very interactive with questions and comments throughout the presentation. There were about 50-60 people in all,…

4

Sucked into a black hole...

I have been neglecting my blog lately due to an insane project I got sucked into…   Compressing 12 man weeks of work into 4 calendar weeks is harder than it sounds.  I managed it though, and yesterday I handed off the final deliverable to the customer (who BTW still can’t believe I pulled it off).   The…

0

Loading XML data into your Infopath form with IXMLDOMDocument.ImportDom

This isn’t a very common scenario, but every now and then the need arises to programmatically populate an Infopath form (from scratch) with data.  After preparing the data in the required schema, my first thought was to do a simple “ThisXDocument.DOM.loadXML(strMyData)”.  However that call triggers  a “the DOM can’t be loaded twice” error.  Another way…

0

Why doesn't InfoPath tell us who is the current user? Turns out there is a good reason...

This is a question I have often asked, and been asked by virtually every customer I have worked with: Infopath’s User object includes the following two methods:   IsCurrentUser(domain\username) returns True if the current(ly logged in) user matches the specified user name   IsUserMemberOf(domain\groupname) returns True if the current(ly logged in) user is a member of the specified group…

0

Getting the POSITION() of the PARENT node using Xpath

I just spent waaaaaay too long figuring this out, so I’ll leave a note of it for future projects: To enumerate the current node’s position in the current nodeset, position() is great.  However when using nested nodesets, getting the parent’s position relative to its nodeset is a bit more complex: count(parent::*/preceding-sibling::*) + 1 – assuming…

5

Infopath forms and the XmlNamespaceManager

One common task when programmatically manipulating an InfoPath form is setting up the namespace manager.  The following code will fail:    MyInfopathDOM.SelectSingleNode(“//my:name”);  because of the unrecognized “my” prefix.  But create a namespacemanager with the namespaces used in the form and you are good to go: MyInfopathDOM.SelectSingleNode(“//my:name”,myNamespaceManager); Luckily, Infopath lists all the required namespaces in one place: the…

1

Office / Information Worker related weblogs

If anyone is interested, here is a compilation of 78 weblogs with Office or IW related themes:It was exported from my SharpReader so YMMV in other readers.  <Added:  About 90% of this list is from http://www.officezealot.com – recommended! >     <outline title=”Information Worker”>        <outline type=”rss” title=”Thom Robbins: InfoPath Tips and Tricks” description=”The place to find interesting InfoPath information”…

4

Programmatically caching Infopath templates using Application.CacheSolution

Infopath has a simple and elegent system for caching form templates – when you open a form with an unknown template, it extracts the template version and location information from an XML processing instruction (PI) in the form, and then loads the template from the specified location and caches it on the local machine. All this happens behind…

1

XmlDocument.CreateProcessingInstruction goes better with XmlDocument.InsertBefore

Note to self: Next time you need to add a Processing Instruction (PI) to an XmlDocument, ignore the MSDN documentation sample which uses XmlDocument.AppendChild.  That sample isn’t exactly incorrect, however it does result in the PI being appended to the end of the document , which probably matches about 0.0001% of the typical usage scenarios.  Using XmlDocument.InsertBefore( PI,…

1