WSS Adapter handling of InfoPath forms with attachments

InfoPath supports forms with file attachments by encoding the attachement as base64 and including the following PI

<?mso-infoPath-file-attachment-present ?>

at the top of the XML document to indicate that a file has been attached to the document.

WSS adapter works with InfoPath forms with attachements by making sure that it does not add/remove/update any of the PIs that are related to file attachment. If the files are attached to the form in InfoPath then the PI should be there because InfoPath adds it. If the files are attached by your orchestration or some component other than InfoPath, then the orchestration/component needs to add the PI explicitly. The adapter cannot know if a file attachment is included in the form (unless the PI is present in which case there's nothing to be done) so it will never add the PI. You can add the PI explicitly in your orchestration using a construct like this:

msg(XMLNORM.ProcessingInstructionOption) = 1;
msg(XMLNORM.ProcessingInstruction) = "<?mso-infoPath-file-attachment-present ?>";

So, whatever component attaches the files to the form needs to also add the PI. WSS adapter will preserve the PI if it's in the document, but it will never add such a PI to the XML document.

Comments (2)
  1. Mike Kolling says:


    Is it possible for Biztalk to open an infopath message and place the file attachments to the infopath message into a folder?

    Is there any sample code of how to do this?


  2. Garry Trinder says:

    Yes, it should be possible, but I don’t know of any existing samples. You need to get the base64 encoded string from the XML document (using an xpath, or a distinguished property) and then decode it using C# code and the Convert.FromBase64String method. You need to create a BizTalk message from the resulting byte[] and then send that through a port to a file.

Comments are closed.

Skip to main content