Validating attachment filenames on a SharePoint InfoPath form


My Blog

Recently we ran into a problem when we modified a SharePoint list form with InfoPath. When users added an attachment with special characters in the filename we would get an error message whenever we would try to save the list item (this was expected off course).

InfoPathWarning

Although the message clearly states that the form could not be submitted the item was still added to the list (without the attachments). This led to duplicate list items which was a big issue in this particular case.

According to a thread on the msdn forum we are not the only one having this problem: http://social.msdn.microsoft.com/Forums/en-US/c9ebf3fc-062c-4ad6-9d0d-fde440e0edff/sharepoint-info-path-form-attachment-file-name-should-not-contain-special-character-

The solution we came up with was to add some validation on the filenames in the InfoPath form. This was challenging because InfoPath does net let you create rules for attachment fields. This is how we solved it:

  1. Create a text field on the InfoPath form. We called…

View original post 131 more words