473,385 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Save Mapi.Message as MSG file

Hi,

This is the first time I've posted something on here.
I've looked around the web for hours and failed miserably. Hopefully
someone out there would be able to help.
I'm trying to save an MApi.Message object (which represents an
email)
to my hard drive or a network drive as an MSG File but I'm getting
nowhere. I know I
can use Redemption to do this but I'm trying to avoid 3rd party
products (especially ones I have to pay for)
Here's my code (converted from VB.NET)
-----------------------------------------

{
MAPI.Session oSession = new MAPI.Session();
MAPI.Folder oFolder;
MAPI.Messages oMessages;
MAPI.Message oMessage;
string strEmailAccount = "Exchange_Email_Account";
string strExchangeServerName = "exchange04";
object profile = null;
string strProfile = strExchangeServerName + Constants.vbLf +
strEmailAccount;
oSession.Logon("", , , false, , true, strProfile);
// Get Inbox.
oFolder = oSession.Inbox;
// Get Messages collection.
oMessages = oFolder.Messages;
// Get the second email
oMessage = oMessages.Item(2);
}
-------------------------------------------
Your help will be greatly appreciated
Jun 27 '08 #1
3 3589

Hi Nabil, there is not reason to use Redemption (unless your customers
hates the Outlook security msgboxes ;-))

This code did the trick in my outlook add-in

dim objMailItem as Outlook.mailitem
objMailItem.SaveAs (FileName)

You should have a look at http://www.outlookcode.com/

Best regards

Kasper
I'm trying to save an MApi.Message object (which represents an
email)
to my hard drive or a network drive as an MSG File but I'm getting
nowhere. I know I
can use Redemption to do this but I'm trying to avoid 3rd party
products (especially ones I have to pay for)
Jun 27 '08 #2
Thanks kasper. This code is to run on a server which doesn't have
Outlook installed. instead I only have Microsoft Messaging API and
Collaboration Data Objects on there!

More specifically, it will run as a Windows Service (Previously NT
Service) so any security message will cause an error anyway!

Thanks for your help anyway!
Jun 27 '08 #3
thd
On Mon, 21 Apr 2008 06:06:22 -0700, Nabil wrote:
Thanks kasper. This code is to run on a server which doesn't have
Outlook installed. instead I only have Microsoft Messaging API and
Collaboration Data Objects on there!

More specifically, it will run as a Windows Service (Previously NT
Service) so any security message will cause an error anyway!

Thanks for your help anyway!
AFAIK, you can only get .MSG files using Outlook, or Redemption.

Tom Delany
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Chris | last post by:
I'm trying to send an e-mail through outlook. So far I've gotten it to work with the mail script at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/149461 My only problem is that when I...
1
by: V.C.Sekhar | last post by:
Hi there, Can any one please help in getting me Python-Outlook programming issue clarified. I just wanted to do the following using Python: 1)Open a New Oulook Mail Window
2
by: Larry Eaton | last post by:
According to MSDN there is MAPI example code in a file SIMPLE.CLI I cannot locate this file. Can anyone direct me to the location of this? It doesn't appear to be anywhere in...
3
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and...
0
by: jackiewkc | last post by:
Hi, Does anyone know how to use VB to write a simple MAPI to save email attachments from a specified email address to my hard drive? What I basically want is that everytime when I receive an...
1
by: bobh | last post by:
Hi All, I've been using this function which I got from here for some time now in two of my AccessXP multiusers applications and it has worked without issue until lately it has stopped functioning...
3
by: Nabil | last post by:
Hi, This is the first time I've posted something on here. I've looked around the web for hours and failed miserably. Hopefully someone out there would be able to help. I'm trying to...
1
by: Nabil | last post by:
Hi, This is the first time I've posted something on here. I've looked around the web for hours and failed miserably. Hopefully someone out there would be able to help. I'm trying to save...
15
by: squrel | last post by:
Hi everyone.. i need ur help once more time.... i have a form called reminder..in tht form i have: txtid, txtcaseid, txtreminder, cmbremindby(system or user), txtremindto, dtpreminddt,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.