BizTalk FTP Adapter – How to send an FTP message with a specified filename

Posted: November 25, 2010  |  Categories: Adapters BizTalk Orchestrations Visual Studio

There are many approaches to this. I’ll give the simple (or basic) way to do.

Set the FILE.ReceivedFileName and use the %SourceFileName% macro

In the orchestration Construct Message shape, add a Message Assignment shape and then you can set the FILE.ReceivedFileName property for your flat file message as so:

OutputMsg(FILE.ReceivedFileName) = System.DateTime.Now.ToString("yyyyMMdd") + ".txt"

This sets a context property that will then be used when you wire a static send port to your orchestration port. In your static send port, you specify the FTP adapter with a target file name like:

  • %SourceFileName%

And the FTP adapter then replaces the %SourceFileName% macro, giving you a filename like “20101125.txt”

So whether you use the file or FTP adapter it is always FILE.ReceivedFileName you need to use.

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.

4 thoughts on “BizTalk FTP Adapter – How to send an FTP message with a specified filename”

  1. Urgent Direct Client Requirement

    Position : BizTalk Architect
    Location: Baton Rouge, LA, USA
    Contract Type : Permanent hire
    Positions: 1

    Required Skills :
    Total IT exp of 10+years of exp
    8+years of BizTalk experience in BizTalk 2004/2006/2006R2/2009
    Excellent understanding and work experience on HIPAA and EDI
    Either contract to Hire or permanent Hire

    Please send the resume to :

  2. Can you also display the file recordcount. What I mean is after the filename can you add the record count for the said filename?

    1. I don’t know if I quite understand your question, but inside orchestration you can configure the sourcefilename as you want.

      You can calculate the number of records by using an expression something like: rcount = xpath(message, “count(….)”);

      And then set the property FILE.ReceivedFileName like:
      OutputMsg(FILE.ReceivedFileName) = “Some name” + rcount + “.txt”

  3. I have done this in the past without an orchestration. I was picking up the messages into a SQL receive adapter, so I included the filename I wanted in my source schema. Then I let the XML assembler in the pipeline promote the filename field into the File.ReceivedFileName context property.
    This would not work for all scenarios, but it suited my needs.

Leave a Reply

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

BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More

Manage and monitor serverless
components effortlessly

Learn More
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top