Before/After properties not available for InfoPath content types in Form Library – MOSS 2007

I wanted to blog this as an FYI... So, I will try to deliver the message short.

When we publish an InfoPath 2007 form template to a MOSS 2007 server, we have an option to choose to publish field in the InfoPath template (as content types), which makes InfoPath fields available as columns in form library.

This is a useful feature, however, if you intend to use custom event handlers in that form library, that "type" of publishing is something you don't want to do.

Why?  Because these fields that are exposed by the form library (actually the InfoPath template) aren't correctly recognized by the SPItemEventProperties object.  On a form library that has a column provided by InfoPath template, you will see the Before/After properties are empty.

The reason appears to be the way these columns are understood.  I guess, the Before/After properties "look out" for SPField types.  Since the columns provided by form template isn't of type SPField, (I guess that should be SPContentType?) the SPItemEventProperties don't bother to record the current object's Before/After properties.

A simple fix: Don't choose "make the InfoPath fields available as column in document library".

Another simple fix: Create columns in the form library instead of allowing InfoPath to supply them for you!

Searched in the cyber space but couldn't find enough information on this - so doing my little part 🙂

Comments (2)

  1. I wanted to blog this as an FYI… So, I will try to deliver the message short. When we publish an InfoPath

  2. Thank you Sridhar!  This confirms what I suspected after struggling for a couple of hours to update a SharePoint InfoPath content type field value within my event receiver.

    Another somewhat related question that I posted to the MSDN forums and the Partner MSDN, but everyone seems stumped.  I can’t get any event receivers (ItemAdded, ItemAdding, ItemUpdated, etc.) to fire when I register them with an InfoPath-published content type.  Yet, the same exact event receiver will register just fine with the forms library that has that content type as its default.  Have you stumbled onto this issue at all?  Feel free to ping me @ if you need additional details to duplicate the issue.

    Here’s the link to the forum posting:



Skip to main content