Hi,
I have more then 1000 file in .msg format. each file having pdf attachment. i wnat to extract the all attachment and save that in my harddisk.please give some idea how can i will do it.
Thanks in advance.
Loading
Hi,
I have more then 1000 file in .msg format. each file having pdf attachment. i wnat to extract the all attachment and save that in my harddisk.please give some idea how can i will do it.
Thanks in advance.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nipun TomarRank #90 · 23K reputationPosted Dec 16, 2013, 8:21 PM EST
http://stackoverflow.com/questions/20567357/how-to-extract-pdf-attachments-from-msg-file-in-c
Try the below code:
private static void main() { //create new Outlook message from file OutlookStorage.Message outlookMsg = new OutlookStorage.Message(@"C:\test.msg"); } private static void SaveMessage(OutlookStorage.Message outlookMsg) { outlookMsg.Save(outlookMsg.Subject.Replace(":", "")); foreach (OutlookStorage.Attachment attach in outlookMsg.Attachments) { byte[] attachBytes = attach.Data; FileStream attachStream = File.Create(attach.Filename); attachStream.Write(attachBytes, 0, attachBytes.Length); attachStream.Close(); } foreach (OutlookStorage.Message subMessage in outlookMsg.Messages) { SaveMessage(subMessage); } }http://www.codeproject.com/Articles/32899/Reading-an-Outlook-MSG-File-in-C
Thanks
Leon DRank #851 · 2.6K reputationPosted Aug 26, 2020, 5:44 PM EDT