BizTalk Server Tutorial

BizTalk Server Concepts and Common Errors

How to change the Output file name in BizTalk File Adapters?

In Many situations we may have to save the file in the Output folder in a proper format.

BizTalk Send Port with File Adapter supports the following formats (macros) for the files saved.


Incase if we want the output file name to be some thing other than the available macros, we need to do some coding either in the Orchestration or in the Pipeline.

This Post will show you how you set the output file name in an Orchestration.

Scenario: Create a schema, receive a file of that type and set a name for the file and save it back to an output folder.

1. Create a sample schema in a BizTalk Project and add an Orchestration to the project.
2. Create two messages of the Schema Created in above step
3. Add a Receive, Message assignment and Send Shape as shown below.
4. Configure the Receive shape to Receive Message_1, set activate to true.
5. Configure the Construct Message shape to construct Message_2 and Send shape to Send Message_2. Resulting Orchestration should look like below.

6. Add the following code in the Message Assignment shape.

Message_2 = Message_1;
Message_2(FILE.ReceivedFileName) = “MyOutputFile”;

7. Add a receive and send ports and complete the Orchestration.

8. Deploy the Orchestration.

9. Configure the Send Port File Adapter as show below. (Change the file name to use %SourceFileName% Macro. (Case Sensitive)

10. Drop an instance of the Schema in the input folder, and see that the Output file name will be the same as what I have given in Step6.

The idea behind this is that, I have change the ReceivedFileName Context Property of the message received to my desired format and then I have used the % SourceFileName% macro.

The same can also be done using a Pipeline.

Hope it helps.
– Shiv

Web Counters

December 4, 2010 - Posted by | Adapters | ,

1 Comment »

  1. Not sure if I’m missing something here but I can’t get this to work… the filename does not change.

    Comment by J. Knight | June 7, 2013 | Reply

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

%d bloggers like this: