Solved

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

Posted on 2013-01-16
10
885 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
 
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

911 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

16 Experts available now in Live!

Get 1:1 Help Now