Subversion and Biztalk Server 2006 Projects

Visual SVN is a helpful tool for managing Biztalk Server 2006 projects with subversion. With help of software packages Subversion and Tortoise all projects under Visual Studio can be managed – inclusive checkout and commits.

By the way, with Visual SVN it is possible to manage SQL Server Integration Service projects (Business Intelligence) under versioncontrol of subversion.

Receive EMails with Attachment and save the attached files under their original filename

Receiving EMails is possible using the pop3 adapter of Microsoft Biztalk Server 2006. But if you want to save multiple attachments with their original filename, you have to do a little detour with an orchestration.

Following process steps have to be defined:

  1. Create a new Biztalk Project with help of Visual Studio – Insert an new blank orchestration
  2. Definition of a unidirectional receive port with communication direction “I always receive messages on this port” and port binding “Define later”
  3. Definition of a unidirectional send port with communication direction “I always send messages on this port” and port binding “Define later”
  4. Definition of process and the variable nCount of type Int32 (Init value 1)
  5. Compile and provide the orchestration
  6. Create a receive port type POP3 with help of Biztalk Management Tool – Port Configuration with the credentials of you POP3 servers. Important is to set the option “MIME Decoding” to true
  7. Create a send port of type file (e.g.) with help of Biztalk Management Tool – Port Configuration. It is important using makro %SourceFileName%
  8. Activating ports, bind the ports to the orchestration
  9. Starting the orchestration

cc cc receive pop3 messages

Process step GetCount determine the amount of included attachments and save it to the variable nCount

//Set the input message to a var of XLang Message type
oXMessage = In;
// Get count
nCount = oXMessage.Count;

Process step MessageAssignment is called in a loop and transfers one attachment after the other to the send port. The original filename is transfered by MIME.FileName to the File.ReceivedFileName property of the send port, so that with help of the macro %SourceFileName% the original filename can be reused.

//Get the n'th part and set to a new message
Out = oXMessage[n];
Out(FILE.ReceivedFileName) = Out(MIME.FileName);
// Add to count
n = n + 1

Download of the Orchestration

%SourceFileName%

Macro %SourceFileName%

The original filename of a file which has been catched by a receive port can be used again in a send port by using the macro %SourceFileName%. In this way it is possible to move a file from one directory to an another -Ă‚ source filename identical to the destination filename. Also it is possible to send a file via ftp adapter (send direction) to a ftp server, using the same filename. This is needful if your source system (e.g. ERP system) generates a reporting file with a strict filename policy prescribed by owner of the destinate ftp server.