Hi Ranjana,
The scenario you were asking
Once after successfully receiving the messages, from the Message context you can read file name using pipeline component.
Getting the properties of a
file attached to an email message in pipeline components
You read by part name or actual file name.
public void Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
var partName = string.Empty;
// we start from index 1 because index zero contains the body of the message
// which we are not interested
for (int i = 1; i < inmsg.PartCount; i++)
{
var currentPart = inmsg.GetPartByIndex(i, out partName);
var attachmentFileName = currentPart.PartProperties.Read("FileName", "http://schemas.microsoft.com/BizTalk/2003/mime-properties");
var outMsg = pc.GetMessageFactory().CreateMessage();
outMsg.AddPart("Body", pc.GetMessageFactory().CreateMessagePart(), true);
outMsg.Context = PipelineUtil.CloneMessageContext(inmsg.Context);
outMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", attachmentFileName);
_msgs.Enqueue(outMsg);
}
}
public void Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
var partName = string.Empty;
// we start from index 1 because index zero contains the body of the message
// which we are not interested
for (int i = 1; i < inmsg.PartCount; i++)
{
var currentPart = inmsg.GetPartByIndex(i, out partName);
var outMsg = pc.GetMessageFactory().CreateMessage();
outMsg.AddPart("Body", pc.GetMessageFactory().CreateMessagePart(), true);
outMsg.Context = PipelineUtil.CloneMessageContext(inmsg.Context);
outMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", partName);
_msgs.Enqueue(outMsg);
}
}
Blogs / Resources for understanding the POP3 flow.
You can go through below articles for understanding the basic flow, handling flow.
How to configure POP3 adapter to receive messages from outlook.com in BizTalk
Biztalk POP3 Adapter Sample
BizTalk Server POP3 adapter
POP3 Sample Document
Email-attachments-in-biztalk-2006.
Thanks, SMSVikasK
-
Proposed as answer by
Rachit Sikroria
Saturday, August 29, 2015 11:15 AM