?
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,009 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
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

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…
New style of hardware planning for Microsoft Exchange server.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

752 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