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

Posted: November 25, 2010 in BizTalk
Tags: , ,

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.


Tags: BizTalk | Macros | FTP Adapter

  1. Naga Raj says:

    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. Godfrey Chisanga says:

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

    • 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”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s