BizTalk Server: Get Tracked Message tool

Posted: January 5, 2022  |  Categories: Administration BizTalk Tools

I recently brought some old BizTalk Server resources back to life, like the BizTalk Server WCF-Loopback Adapter or File-Z Adapter. And I have been working on several more resources. So today, it is a pleasure to bring back to life again an old tool created by my friend Thiago Almeida (LinkedInTwitter) back in the day he was a BizTalk Server developer:

  • Get Tracked Message tool

This tool allows you to programmatically extract a message body from the BizTalk tracking database using 3 possible ways, as Thiago Almeida mentioned in his original blog post:

  • Operations DLL: this method uses the Microsoft.BizTalk.Operations assembly. This is pretty straightforward. You add a reference to Microsoft.BizTalk.Operations.dll and use the GetTrackedMessage of the BizTalkOperations class. You can also get to the message context using this method. This method is only available for BizTalk Server 2006 and late.
  • SQL: this method uses the bts_GetTrackedMessageParts stored procedure inside the tracking database expects the message GUID and will return the compressed message data. We can then use reflection to invoke the Decompress method of Microsoft.BizTalk.Message.Interop.CompressionStreams class inside Microsoft.BizTalk.Pipeline.dll to decompress the data returned from SQL.
  • And WMI: this method uses the WMI MSBTS_TrackedMessageInstance.SaveToFile method to save the instance to disk. This was the popular method in BizTalk Server 2004 since there were no operations DLL back then.

As some of you know, the body and context of messages in BizTalk are compressed, and rightfully so. However, the actual compression and decompression code are hidden inside an assembly called BTSDBAccessor.dll. This DLL, the BizTalk Database Accessor, is unmanaged and does a lot of work for BizTalk, including accessing the BizTalk databases to send and receive messages.

The application has only one form and expects the following parameters:

  • The message guid of the message you want to extract.
    • You can get this value for example, from the Message Flow
  • The extraction type (Use Operations DLL, Use SQL, Use WMI)
  • Tracking DB server (the BizTalk server name)
  • Tracking DB name (the BizTalk Tracking database name)


  • Thiago Almeida | Linkedin | The original craetor of this tool.
  • Diogo Formosinho | Linkedin | Member of my team and that help me migrate this tool and that add a more modern look to the tool.



You can download the BizTalk Server GetTrackedMessage tool from GitHub here:

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to Top