Automatically publish InfoPath form to SharePoint


I have a working solution to create an InfoPath form from a Lotus Notes form. It’s good; but I want to make it great. I also need a feature to automatically publish the InfoPath form. It’s rather tedious to publish a form through the InfoPath client. It would be painful to do that for 100+ forms.

So I searched around for some solutions and found some that were interesting. I started with this posting:

http://www.sharepointblogs.com/koning53/archive/2007/10/16/infopath-vsto-post-build-steps.aspx

I added code to my migration solution to create a batch file and run it. The content of the batch file appears below.

“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o deactivateformtemplate -url http://litware/ -filename “C:\Documents and Settings\Administrator\My Documents\InfoPath\SharepointPoC.nsf\Issue\cab\Issue.xsn”
“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o execadmsvcjobs
“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o uploadformtemplate -filename “C:\Documents and Settings\Administrator\My Documents\InfoPath\SharepointPoC.nsf\Issue\cab\Issue.xsn”
“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o execadmsvcjobs
“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe” -o activateformtemplate -url http://litware/ -filename “C:\Documents and Settings\Administrator\My Documents\InfoPath\SharepointPoC.nsf\Issue\cab\Issue.xsn” 

I can dynamically create the batch file. The batch file has to run on a machine running SharePoint 2007 server. The batch file should remove a previous InfoPath form if it exists. It will post the new InfoPath form to the SharePoint server. The new InfoPath form should then be activated.

Unfortunately, I am getting an error when running some of the stsadm commands:

     The following form template cannot be found: urn:schemas-microsoft-com:office:infopath:Issue:-myXSD-2006-01-01.

So I need to figure out what is wrong here.  I’ll have to spend more time researching and debugging it.

The other interesting item I found is the mentioning of a best practice. On page 951 of “Designing Forms for Microsoft Office InfoPath and Forms Services 2007”, it mentions that administrative-deployed form templates generally exhibit slightly greater performance than equivalent user-deployed  forms. So I’ll take this approach to get a little more performance using Forms Services.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s