Splitting POP3 Email Attachments in BizTalk 2006

This was a question (paraphrased) on the BizTalkGurus.com Forum: “How can I take email attachments and put them as is into a folder?”


 


When using the POP3 Receive Adapter, you have the ability to receive multiple items as attachments and the adapter will handle them using MIME processing.  You do not need a custom pipeline. 


 


When receiving a multi-attachment message, you have the ability to define one of the parts as the main message Body.  If you leave the default (0), the email message body will be the main message Body and all attachments will be additional parts to the message.


 


Lets say you have 3 attachments and you want to receive in an email and write them out to disk in a folder location (you can always publish them to the message box and do anything you want with the messages).  You could probably use a custom pipeline to break out the multi-part message into separate messages… 


 


I found a very simple and straight forward approach to accomplish this task.  The Orchestration looks like this:


 



 


The key is to create an Orchestration variable of type Microsoft.XLANGs.BaseTypes.XLANGMessage.  In order to do this, you need to add a reference to Microsoft.XLang.BaseTypes.dll.  Once you have this variable, you just need to set it equal to your input message like: oXMessage = In. 


 


You now have access to everything the XLangMessage has available; most importantly Count and access to all the message parts.  Now a simple loop can be used to loop over the parts and create new output messages for each message part. 


<SPAN style="FONT-FAMILY:

Commerce Server 2007: Migration Guide Available

The Commerce Server team has put together a really good migration help file which you can download and review before you begin your migration project. It also includes a very detailed step-by-step guide for migrating from CS2002 to CS2007. This is a great resource for anyone interested in the changes between the earlier versions of Commerce Server and the latest version.


Microsoft Commerce Server 2007 Migration Guide


Technorati Tags: Commerce Server

Share this post: Email it! | bookmark it! | digg it! | reddit!| kick it!

Building and Deploying BizTalk Solutions with MSBuild

This sample shows how to use MSBuild (available with Visual Studio 2005) to build, deploy, and undeploy a BizTalk 2006 Solution. This sample does not use an MSI or a binding file and build, binds, and deploys all BizTalk and .Net code using MSBuild Tasks. This sample uses the custom tasks developed by Microsoft UK and available on GotDotNet.

This sample will work with BizTalk 2006 and BizTalk 2006 R2.

Get more information from the original blog post on this topic: http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2006/08/07/how-to-build-and-deploy-biztalk-solutions-using-msbuild.aspx

How To Build and Deploy BizTalk Solutions Using MSBuild

MSBuild is the new build platform for Visual Studios.  It allows great flexibility, customization (through creating custom Tasks), and integration with unit tests.



While MSBuild doesn’t directly support building BizTalk solutions, tasks are available to call the DEVENV executable and Microsoft UK has released a set of custom tasks to support a wide verity of common BizTalk tasks (available on GotDotNet).  This provided an easy method for scripting automated or ad-hock BizTalk builds and deployments using MSBuild.



What can MSBuild do for you?


       Allow for automated and scheduled builds of your BizTalk code


       Extract code from Team Foundation Server (or other source control)


       Run unit tests


       Deploy BizTalk code to local or remote servers


       Control your overall BizTalk deployment by removing past solutions, stopping applications, and terminating Orchestrations



I have put together a sample to show the power and flexibility of using MSBuild for you BizTalk Build, Deployment, and Undeployment.



Download: BizTalk 2006 Build and Deployment with MSBuild


(Note the download included the custom BizTalk task binary files from GotDotNet and required license file.)



This solution provides a sample of how to set up a MSBuild script to build, deploy, and undeploy a BizTalk 2006 Solution.  This solution has multiple projects and custom .net code. I also use MSBuild to create all required Send and Receive Ports and bind them to the Orchestration. 



The whole build and deployment process does not use a MSI or a binding file.  Although, I would have used a binding file but I wasn’t able to get the custom task to work correctly.  This approach might not be the best solution to your deployment needs, but is intended to show you what can be done and how.



To run the sample, it must be extracted to your C drive unless you manually edit the configuration files.  Once extracted, open a Visual Studio 2005 command window, change your path to C:\SampleDeployment, and type: MSBuild Build.proj to build and deploy the code.  To undeploy the solution type: MSBuild UnDeploy.proj



The Build.proj will automatically do an undeployment if needed.  This sample has only been tested with a local deployment and I was not able to get it to work remotely on my home environment.  I need to do some more research on this. 



In case you get lost in all the files, the FullBuild.proj is the full undeploy, build, and deploy in one file. All MSBuild files have been commented so it should be easy to follow what is going on.



Key files and what they do:



Build.proj – this is basically a control file.  It imports Build.properties, Undeploy.targets, and Deploy.targets.  



Undeploy.proj – this is another control file.  It imports Build.properties and Deploy.targets.  It is used if you just want to undeploy the solution.



Build.properties – this contains solution specific information like the solution name, dll names, application name, and so on.  In theory, this should be the only file you need to update (except I hard coded all the port info into the Build.targets file)



Undeploy.targets – this set of targets handles the termination of running Orchestrations, stopping the Application, and removes the items from the GAC.



Deploy.targets – this set of targets builds the BizTalk solution, creates the Application, creates the ports, deploys the BizTalk assemblies, binds ports to the Orchestration, and starts the Application.



FullDeplou.proj – this file is the same as Build.properties, Undeploy.targets, and Deploy.targets except it has all the targets in one file. 



One huge time saver I found when working with the custom tasks from GotDotNet is to download the source code.  This way you can view the custom tasks, understand input parameters, and see required fields.  It’s a huge time saver.



What’s on the horizon?  Integration with BizUnit, FTS, multiple deployment options (like Dev, Test, Prod), and testing the remote deployment support.  I hope to post more on these topics later on.


Using MSBuild to Build and Deploy BizTalk 2006 Solutions

MSBuild is the new build platform for Visual Studios.  It allows great flexibility, customization (through creating custom Tasks), and integration with unit tests.


 


While MSBuild doesn’t directly support building BizTalk solutions, tasks are available to call the DEVENV executable and Microsoft UK has released a set of custom tasks to support a wide verity of common BizTalk tasks (available on GotDotNet).  This provided an easy method for scripting automated or ad-hock BizTalk builds and deployments using MSBuild.


 


What can MSBuild do for you?


       Allow for automated and scheduled builds of your BizTalk code


       Extract code from Team Foundation Server (or other source control)


       Run unit tests


       Deploy BizTalk code to local or remote servers


       Control your overall BizTalk deployment by removing past solutions, stopping applications, and terminating Orchestrations


 


I have put together a sample to show the power and flexibility of using MSBuild for you BizTalk Build, Deployment, and Undeployment.


 


Download: BizTalk 2006 Build and Deployment with MSBuild


(Note the download included the custom BizTalk task binary files from GotDotNet and required license file.)


 


This solution provides a sample of how to set up a MSBuild script to build, deploy, and undeploy a BizTalk 2006 Solution.  This solution has multiple projects and custom .net code. I also use MSBuild to create all required Send and Receive Ports and bind them to the Orchestration. 


 


The whole build and deployment process does not use a MSI or a binding file.  Although, I would have used a binding file but I wasn’t able to get the custom task to work correctly.  This approach might not be the best solution to your deployment needs, but is intended to show you what can be done and how.


 


To run the sample, it must be extracted to your C drive unless you manually edit the configuration files.  Once extracted, open a Visual Studio 2005 command window, change your path to C:\SampleDeployment, and type: MSBuild Build.proj to build and deploy the code.  To undeploy the solution type: MSBuild UnDeploy.proj


 


The Build.proj will automatically do an undeployment if needed.  This sample has only been tested with a local deployment and I was not able to get it to work remotely on my home environment.  I need to do some more research on this. 


 


In case you get lost in all the files, the FullBuild.proj is the full undeploy, build, and deploy in one file. All MSBuild files have been commented so it should be easy to follow what is going on.


 


<P