I am writing a code that would programatically remove any content from an Attachment control. There is a nice article about this from bizsupportonline >>
http://www.bizsupportonline.net/blog/2009/10/delete-remove-clear-attachment-infopath-form/
a. I created an InfoPath 2010 form, with an Attachment control. I applied this code to the form's Loading Event. I published to SharePoint 2010; and set the form library to 'Open in Browser'
b. I then added a document and attached a file to the document.
This solution works, but only when I reopen using "Edit Microsoft InfoPath"
When open the form using a browser (Windows 7 Enterprise SP1), I would get a warning message with a correlation id. The trace log gave me this message:
"Business logic failed due to an exception. (User: , Form Name: AttachmentDemo, IP: , Request: , Form ID: urn:schemas-microsoft-com:office:infopath:AttachmentDemo:-myXSD-2012-12-05T20-59-41, Type: SchemaValidationException, Exception Message: Schema validation found non-datatype errors.)"
Is ther something that I should do differently to clear an attachment control in browser mode?