Solved

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

Posted on 2013-01-16
10
863 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
Comment Utility
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
Comment Utility
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
Comment Utility
Then thats how you do it Manually. Just drag and drop form outlook to a folder.
0
 
LVL 37

Expert Comment

by:Neil Russell
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 37

Expert Comment

by:Neil Russell
Comment Utility
0
 

Author Comment

by:valuelabs97
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now