Free Support Forum - aspose.com

LinkedResource file type

Hi there,
is there any way to find out the original file type of an linked resource??
best regards,
Miguel de Sousa

Hi Miguel,


The Linked Resource’s ContentType property provides information about the file type of that resource. You can retrieve this information using following lines of code. Please let us know if you have any additional query/inquiry in this regard.


MailMessage mailMsg = MailMessage.Load(“Test.msg”);

LinkedResource lr = mailMsg.LinkedResources[0];

string strFileType = lr.ContentType.MediaType.ToString();

Console.WriteLine("File Type of Linked Resource: " + strFileType);


Hi Kashif,
let me thank you for your quick reply.
the code you mention didn’t help me much, it returned application\octet-stream on a jpg
I know that it is an jpg because I send that email and embedded the image myself using the linkedresource.
Any idea on how can I fix this?

Best regards,
Miguel de Sousa

Hi Miguel de Sousa,


Could you please provide us your sample message as I was unable to observe this issue at my end using a message file that has an embedded JPG in it. I also tried it using our online article and it returned the correct results. I would also request you to please provide us sample code you are using to embed the JPG as a linked resource, so that we can investigate the issue and assist you further.

Also, please try the latest version of Aspose.Email for .NET 2.6.0 in your application.