472,995 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,995 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 3570

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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.