Solved

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

Posted on 2013-01-16
10
971 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

691 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