Hello Asad Ali and thank you very much for your reply.
The way you proposed works sucessfully for file streams. I just forgot to mention in the previous message that as an input stream parameter I have a System.IO.MemoryStream stream type which I cannot use to determine what extention I have (at least I have not found any way).
I am attaching a zip archive containing sample msg file so you would be able to reproduce it in your environment. The following code snippet is enough to get the result I am writing about:
// This is just to emulate my initial conditions having memory stream in the beginning -->
// converting fileStream to a MemoryStream
System.String msgFilepath = “filepath\MSG_PDF_Attached_Sample.msg”;
System.IO.FileStream filestream = new System.IO.FileStream(msgFilepath, System.IO.FileMode::Open, System.IO.FileAccess::Read);
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
filestream.CopyTo(memoryStream);
// This is just to emulate my initial conditions having memory stream in the beginning <–
// I have a memory stream as an input parameter
// Passing input msg memory stream containing pdf attachments
Aspose.Pdf.Facades.PdfFileInfo fileInfo = new Aspose.Pdf.Facades.PdfFileInfo(memoryStream);
// IsPdfFile returns true as msg memory stream contains pdf file as an attachment
// I would expect to have false in case this is initially an outlook message format file
boolean isPdf = fileInfo.IsPdfFile;
filestream.Close();
memoryStream.Close();