Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Email Attachment’s filename
- This topic has 3 replies, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
May 8, 2006 at 3:15 AM #13518
I can successfully pick up a file and send it as an email attachment. But the attachment’s filename is ’Attachment’, when double click to save it, it will default save the file as name “TestLocationNZCMAN000000000804.TXT”, in which “TestLocationNZC” is the path for the pick up file, and MAN000000000804.TXT is the original file name.
I didn’t use custom pipeline, (I tried but don’t know even if read the “ReceivedFileName” then how to reference it in orchestration)
Instead, I created one String Variable “OriginalFN” in Orchestration, in one Expression shape I added the following code: OriginalFN=ReceivedMessageType(FILE.ReceivedFileName);
Then in an message assignment shape:
//setup email attachment and content type, MSGtoSend is the multipart message to send
MSGtoSend.Attachment= ReceivedMessageType;
SMTPUtils.Part.SetContentType(MSGtoSend.Attachment, \”text/xml\”);
SMTPUtils.Part.SetFileName(MSGtoSend.Attachment,OriginalFN);I’m wondering how to make the attachment read as the original file name. Any thoughts and suggestion? Thanks in advance.
===============
BTW,
In my custom pipeline I used coding like this:
public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg){
const string FILEadapterTargetNamespace = \”http://schemas.microsoft.com/BizTalk/2003/file-properties\”;
string sourcePath = inmsg.Context.Read(\”ReceivedFileName\”, FILEadapterTargetNamespace ) as string;return inmsg;
}
But I didn’t implement IDisassemberComponent, and when I put it under Pipeline Disassemble, it gives error to let me implement this interface. Also I don’t know how to reference the “ReceivedFileName” in orchestration. -
May 9, 2006 at 12:07 AM #13519
Thanks, Greg.
I added an C# Class Library to do the String manipulation on the variable. I can get the right original filename when double click the attachement to save it.
But in the mailbox, you can see the attachment is still called \”Attachment\”, if this is the way Biztalk dealing with email attachment, i may have to change the mail subject to reflect the different attachment filename in every email.[/code]
-
May 8, 2006 at 9:18 AM #13520
Merry,
The FILE.ReceivedFileName property will return the complete path of the received file.
To extract just the filename you will need code like this:
[code:1:7cf09cb70c]OriginalPath = ReceivedMessageType(FILE.ReceivedFileName);
OriginalFN = OriginalPath.Substring(OriginalPath.LastIndexOf(’\\\\’) + 1);
SMTPUtils.Part.SetFileName(MSGtoSend.Attachment,OriginalFN); [/code:1:7cf09cb70c]You do not need a custom pipeline component. The FILE.ReceivedFileName property is set by the File Adapter.
-
May 9, 2006 at 1:45 AM #13521
Merry,
What version of Outlook are you using. I found the older Outlook XP uses the Content-Description property to display the filename, while Outlook 2003 uses the FileName property.
I did try to set the Content-Description property by adding the following procedure to the SMTPUtils.
[code:1:3e1122fd99]public static void SetContentDescription(Microsoft.XLANGs.BaseTypes.XLANGPart part, string contentDescription)
{
part.SetPartProperty( typeof(MIME.ContentDescription), contentDescription);
}[/code:1:3e1122fd99]But the MIME/SMIME encoder did not appear to use this as the Content-Description, instead used the Biztalk Message Part name. I did not pursue this any further, the recommended fix was to upgrade mail clients.
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.