Programmatically Activating an InfoPath Form Template
A colleague today asked me whether it was possible to programatically activate an InfoPath form template from the form templates store in Central Administration to a site collection. After much digging around in the MOSS SDK I couldn't really find anything until I stumbled across the forms services SDK online. Using a combination of the two I came up with the following which shows how to do this:
Firstly you'll need to add a reference to the Microsoft.Office.InfoPath.Server.dll assembly, which can be found at the following location:
C:\Program Files\Microsoft Office Servers\12.0\Bin
After adding a reference to this assembly you can use the following code fragment to achieve the requirement:
SPSite siteCollection = ...
SPServiceCollection services = SPFarm.Local.Services;
foreach (SPService svc in services)
FormsService fs = svc as FormsService;
if (fs != null)
foreach (FormTemplate ft in fs.FormTemplates)
if (ft.Name == "<the name you want>")
Hope this helps !