Last year I wrote an entry about adding arbitrary binary attachments to a Multi-Part message in BizTalk 2006 using a helper C# component. That entry has been fairly popular (as far as BizTalk posts go, which is not usually much!), and I occasionally get questions about it.

The sample uses a bit of clever code to insert arbitrary attachments into an existing XLANGMessage instance during construction. However, it's not very clear that this is actually a supported scenario and so there's always a chance it might get you into trouble.

I recently thought of another way, possibly much better supported to accomplish the same in BizTalk 2006, though with a little performance hit: Use the Invoke Pipelines feature in BizTalk 2006 Orchestrations.

Basically, the idea would be to create a custom pipeline component (depending on what you need it could be a regular encoding/pre-assemble or an assembler component), generate a new multi-part message in it, and return that to the orchestration.

I haven't tried it yet, but I think it should work.

Technorati tags:

Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.