The BizTalk Pipeline Components Extensions Utility Pack, a community project for BizTalk Server 2016, has received another update. This release introduces a new component that you can use in custom BizTalk Server pipelines: the Local Archive Pipeline Component.
📝 One-Minute Brief
Introduces the Local Archive Pipeline Component for BizTalk Server, a custom pipeline component that allows you to archive incoming and outgoing messages from any adapter to a local or shared file system location.
Local Archive Pipeline Component
The Local Archive Pipeline Component allows you to archive incoming and outgoing messages from any BizTalk adapter in a simple and flexible way.
This component provides the following capabilities:
- You can use it in any stage of a receive pipeline or a send pipeline.
- You can place it in multiple stages within the same receive or send pipeline.
- You can configure the destination path where BizTalk saves archived messages, including:
- local folders
- shared folders
- network locations
The component works with any adapter:
- When the adapter promotes the
ReceivedFileNameproperty (for example, the File or FTP adapter), the component uses that value and saves the message with the original filename. - When the adapter does not provide a filename, the component saves the message using the MessageID as the filename, without an extension.
public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
//
// TODO: implement component logic
//
// this way, it's a passthrough pipeline component
if (this.PerformBackup)
{
try
{
//Get Message Id
Guid msgId = inmsg.MessageID;
//Get Filename by FileAdapter NS
string fileName = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties").ToString();
if (string.IsNullOrEmpty(fileName))
{
fileName = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/ftp-properties").ToString();
if (string.IsNullOrEmpty(fileName))
{
fileName = msgId.ToString();
}
}
if (!new DirectoryInfo(this.Folder).Exists)
{
try
{
Directory.CreateDirectory(this.Folder);
}
catch
{
throw;
}
}
SaveStreamToFile(inmsg.BodyPart.Data, fileName, true);
inmsg.BodyPart.Data.Position = 0;
}
catch
{
throw;
}
}
return inmsg;
}
What is BizTalk Pipeline Components Extensions Utility Pack?
BizTalk Pipeline Components Extensions Utility Pack is a set of custom pipeline components (libraries) that can be used in received and sent pipelines, extending BizTalk’s out-of-the-box pipeline capabilities.
The project is available on the BizTalk Server Open Source Community repository on GitHub (https://github.com/BizTalkCommunity), and everyone can contribute new pipeline components to extend or improve existing BizTalk Server capabilities.
At the moment, it is only available for BizTalk Server 2016, but it will soon be compiled and available for previous versions of the product.
Download
You can download BizTalk Pipeline Components Extensions Utility Pack from GitHub:
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.

Thank you for this.
I can see code in GitHub for BTS2006-2009, BTS2010 and BTS2016.
Can I use the BTS2016 code for BTS2020 ?
I will update soon to BTS2020 but it should work fine
This is what I need! But:
When trying to upload the component to toolbox I get this error: “You have selected an invalid pipeline component assembly. Please check security settings for the assembly if you are loading it from an UNC path.”
I have checked all dependencies and added the dll to “…\Pipeline Components”-folder.
What am I missing?
HI Sandro
Thank you for this good direction.
I am gonna to see and have .Context.read(“ReceivePortName”,”http://schemas.microsoft.com/BizTalk/2003/system-properties”);
in the context window of the suspended message, could you please provide the steps to add ‘ReceivePortName’ to the context of messages details in Biztalk 2020?