How does SharePoint know the Content Type of an InfoPath form saved to a document library ?

When you have multiple Form Content Types with each their respective form templates assigned to the same Form Library by some magic it will automatically save a new form in the correct Content Type. How it does this ?

The new form’s XML contains an InfoPath processing instruction with a “href” attribute set to the XSN template URL. At save time the Content Types configured in the Form Library are iterated and a match is made based on Template URL. If no match is found it will use the default Content Type.


InfoPath Form XML

List Content Type Advanced Settings


Even works in code if you do a SPFileCollection.Add() so no need to specify the Content Type explicitly during saves !

It doesn’t seem to take Alternate Access Mappings into account so that’s a bit of a downer, but still powerful.


Links to this post


CAPTCHA Image Validation