?
Solved

How to extract Email messages in .msg format from Micrsoft Exchange server to a network folder

Posted on 2013-01-16
10
Medium Priority
?
1,089 Views
Last Modified: 2016-02-10
I have a requirement that i need to extract the ".msg" files from one of the exchange server's public folder and save them in a network path.

I read a lot about Exchange Web Services Managed API, but I don't think there is a direct way to get ".msg' file. We can either retrieve ".eml" file or read subject, body, recipients separately and generate ".msg" file. But both the options are not straight forward.

Can anyone suggest me a best way to achieve this?
0
Comment
Question by:valuelabs97
  • 5
  • 4
10 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 38786160
Is this a one off requirement or you want it to run as a task?

If its one off you can just drag and drop them.
0
 

Author Comment

by:valuelabs97
ID: 38786189
As mentioned at the beginning of my question, it is a requirement and it is either performed manually time to time or schedule it as a task.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 38786198
Then thats how you do it Manually. Just drag and drop form outlook to a folder.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:Neil Russell
ID: 38786208
Are you familiar with VBA? You know how to create macros in outlook?

If so then something like....

 
Dim Msg As Variant

 For Each Msg In Application.ActiveExplorer.Selection
 Msg.SaveAs "c:\YourMessageFolder\" & Msg & ".msg", olMSG
 Next

Open in new window


Should do it.
You just select the messages you want to save and then run the macro.

 This would save using the message Subject though and of course you may have LOTS of the same subject, something you would need to consider. Also it wouldnt save/handle and with special charectors in the subject line etc.....
0
 

Author Comment

by:valuelabs97
ID: 38786239
Sorry if I am unclear. This task should be performed by an external application or service by connecting to the exchange server. I am not supposed to use the outlook. Instead I should get the access to the public folder from a custom application or service and pull out the required messages and save it to a network windows location in ".msg" format.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 38786837
0
 

Author Comment

by:valuelabs97
ID: 38786903
Thank you for the information.

In fact, i have gone through this Gluegood software but there is a dependency on Outlook redemption which is not free.

The same is the case with Apose.Email (http://www.aspose.com/.net/email-component.aspx) which also does the same. I would like to achieve using .Net and without using any third party libraries.
0
 
LVL 37

Accepted Solution

by:
Neil Russell earned 1500 total points
ID: 38789162
The reason that products like redemtion exist is because you cant just throw a few lines of code together and gain access to exchange data. TBH paying $250US for a tool that allows everything that redemption does is a no brainer. You will use it again and again if your serious about automated mail services of any kind.
0
 

Author Comment

by:valuelabs97
ID: 38810132
Thanks Neilsr.

I could find the alternative solution for this.

We can achieve this either by using VBscript or.net Interoperability.
0
 

Expert Comment

by:ashish1183
ID: 40726251
Hi,

I am working on a solution to to extract emails from exchange using EWS APIs and then upload to SharePoint online . Below is the sample code for file creation, and before upload to sharepoint for .eml format. However I want to achieve the same functionality for .MSG format.

string mSubject = mItem.Subject;
string targetFileURL = targetFolderUrl + "/" + Regex.Replace(mSubject, @"[^\w\.@-]", "", RegexOptions.None, TimeSpan.FromSeconds(1.5));

//limit URL to 150 characters
if (targetFileURL.Length > 150)
targetFileURL = targetFileURL.Substring(0, 150) +".eml";
else
targetFileURL = targetFileURL + ".eml";

mItem.Load(new PropertySet(ItemSchema.MimeContent));
MimeContent mc = mItem.MimeContent;
FileCreationInformation newFile = new FileCreationInformation();
newFile.Content = mc.Content;
newFile.Url = targetFileURL;
newFile.Overwrite = true;


Any suggestions on how to save the file in proper MSG format? Just to let you all know that we have a lot of custom extended properties created for outlook, which will offcourse not come over with any other format apart from .MSG.


Will greatly appreciate quick responses.

Thanks
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question