How to: Open *.MSG File from Hard Drive via Code

I need to : 
Open *.MSG File from Hard Drive via Code 
and extract the file attachment. I have hundreds of these emails that we 
need the attachments extracted from. But the .msg files are on a hard drive. 

Someone help me out here....

I need the code to open and access the mailitem....
how do I open a .msg file? 
1/28/2010 4:49:02 PM
outlook.program_vba 490 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 48

Use the CreateItemFromTemplate() method for that.

Ken Slovak
[MVP - Outlook]
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.

"Benjamin" <> wrote in message
>I need to :
> Open *.MSG File from Hard Drive via Code
> and extract the file attachment. I have hundreds of these emails that we
> need the attachments extracted from. But the .msg files are on a hard 
> drive.
> Someone help me out here....
> I need the code to open and access the mailitem....
> how do I open a .msg file? 

1/28/2010 4:55:30 PM
Use the Application.CreateItemFromTemplate method. That will create a new 
message based on the .msg file. You can then work with that message's 
Attachments collection.

Sue Mosher, Outlook MVP
   Author of Microsoft Outlook 2007 Programming:
     Jumpstart for Power Users and Administrators

"Benjamin" <> wrote in message
>I need to :
> Open *.MSG File from Hard Drive via Code
> and extract the file attachment. I have hundreds of these emails that we
> need the attachments extracted from. But the .msg files are on a hard 
> drive.
> Someone help me out here....
> I need the code to open and access the mailitem....
> how do I open a .msg file? 

1/28/2010 4:58:00 PM

Similar Artilces:

Help with PST file
Every now and then for whatever reason I get the message that my pst file can't be accessed (Outlook 2000 SR1). So I try to create a new one because I don't know how to fix the problem. After hours of trying, searching for help, etc I get a new pst file. However now in my folders list I have several other personal folders. Also I can never figure out how to get my email addresses from the old personal folder (contact folder) to the newly created one. Can someone help me? I've got to say that much of this goes over my head. For instance I keep reading where I'm supposed to ...

Save formatted text from RichEdit control to rtf-file
Hi , How can I save the text from Rich edit control (2.0) to *.rtf , *.txt , *.doc I tried to get the buffer and putting the buffer to file, then saving the file but the text in the file is something different. Please let me know what to do? Here is the Code I ma using: mFile.Seek( 0, CFile::begin ); CString cBuffer2; int iTotalTextLength = m_oChatMessageControl.GetWindowTextLength(); HWND focusWnd = ::GetFocus(); m_oChatMessageControl.HideSelection(TRUE, TRUE); m_oChatMessageControl.SetSel(iTotalTextLength, iTotalTextLength); cBuffer2 = m_oChatMessageControl.GetSelText(); LPTSTR...

Distribution Files for MFC in VS .net 2003
I have an app that was developed under Visual Studio VC++ 6.0 & MFC and deployed at our customer site. I have since installed Visual Studio .NET 2003 and rebuilt the application under the new development environment. I wanted to do a quick test of the executable and copied it up to a test machine and tried to run it. I got a series of "unable to find xxx.dll" errors. I realized that none of the new DLLs were installed on the test machine. Does anyone have a pointer to a good document on what distribution files are required? I know about the obvious ones like MFC71.DLL...

Money: Err Msg: Path Has Not Been Properly Set Up
please help.... Microsoft Money. The path is not properly set up in the registry or has been moved after running Money's Setup. Please re-install Money. Otherwise, Money may not be able to run properly. re-instal wont help deleting registry entry dasn.t help. windowx xp sp2 Ms Money 97 (v.5.0) .. Are you using an administrator account to run the software? -- Glyn Simpson, Microsoft MVP - Money Check;EN-GB;mny for UK tips and fixes for MS Money. To send Microsoft your wishes or suggestions, use http://registe...

file cloning
I was wondering. How come it is possible to clone a file (using right click copy/paste file), but not possible to do this for other documents (apps and clip-art etc)?. Could it be possible to have an add-in in excel to prevent people from copying documents on their desktop?? -- shnim1 You can copy files that way (rightclick|copy, rightclick|paste). But most windows applications are no longer just simple .exe files (like back in the old DOS days). They usually have tons of other stuff that gets installed with them--and that stuff gets scattered all over your harddrive (windows folder, wi...

converting tabular structures in a Word document into an actual table or reading data from the tabular structures using VBA code
I have a macro which can read the last cell/column of all tables in a Word 2003/2007 document and store the data in an MS-Access table. But, some Word documents have the data in structures like a table format but are not actually tables. The structure looks like a table, but the table borders are actually line connectors. These documents were created by a software(VeryPDF PDF to Word converter) which converted the PDF documents(the original format these documents were) into Word documents. 1. Is there a way I can convert/replace the tabular structures with actual tables in Word so t...

Outlook Live 2003 re: reply to msg sent to different e-mail account
Issue: I want a different e-mail account to display to recipient I'm just subscribed to Outlook Live and using Outlook 2003. I simply want to configure Outlook 2003 as I have my Outlook Express configured (ie receipient sees the same "reply to" e-mail address no matter which e-mail account I use to send the original e-mail). For my POP3 account, I easily configued Outlook 2003 to work using a different "reply to" address. However, for the Hotmail account (http radio button) I don't have the same options available to change the "reply to" address. Rev...

IE8 Will Not Open in Windows 7
I purchased a new PC shortly before Windows 7 was launched. I was able to purchase a disk from the PC manufacturer allowing me to upgrade when Windows 7 was released. I have an IE icon in the task bar but wheh I click it, the hour glass appears fro a few seconds and vanishes. I have scoured for information including open IE with no add ons, creating a new icon etc but nothing works and it will not open. Any ideas please. Does it open in no add-ons mode? See this link for steps you can take -- -- "Brummie" <Brumm...

moving payables data from open to history
Hello: A client says that someone imported data about a year or two ago into Great Plains from their AS400. Many payables documents that were imported should have been coded during the import as open, instead of history. The client knows that she can take care of this herself within two hours, by simply turning off the posting to the GL and entering and posting the payables documents to move them to history. But, she is wondering if there is a quick and easy way to do this on the back-end. I'm familiar with the open and history payables tables within GP. And, I know through a T...

how to build the netsample ipconfig to the exe file?
C:\WINCE500\public\common\oak\drivers\netsamp\ipconfig\ipconfig.cpp i want to make ipconfig.exe. and i could found the sample code. but it source code builded to the lib file. in ipconfig sources files, TARGETNAME=ipconfig TARGETTYPE=LIBRARY SOURCES= \ $(TARGETNAME).cpp the project is .lib file. but the source code has a _tmain() funciton in the source. it's looks possible to compile to the exe file. how can it compile to the exe file? You can add the SYSGEN_NETUTILS and you will have the ipconfig.exe integrated to your OS. Search ipconfig in the cat...

How do I export Lotus Approach files into an Excel spreadsheet?
I need to export data from Lotus Approach to Excel; please help. I am using an old version of Lotus SmartSuite 9.5 and I have Microsoft Office 2003 Basic. Well, I don't know Approach at all but is there a common file format that both use e.g. comma delimited. If so , save in that format from Approach and import into Excel. "LEWOLF" wrote: > I need to export data from Lotus Approach to Excel; please help. I am using > an old version of Lotus SmartSuite 9.5 and I have Microsoft Office 2003 Basic. ... 2008 ContextMenuStrip logical error when running code
Greetings, I have a connectmenustrip item that when clicked runs the following code (see below) Now if the event is called by the button i.e. cmdDeleteingBooking.Click the linq query returns the appropriate value. However when called by cntMnuCancelBookingItem.Click is returns 0 even if a checkbox is of 'TRUE' value. Debugging shows the code runs exactly the same code (which loops around rows in a datagridview checking if the checkbox has been checked). Could someone explain the reasoning why the same code would return different results? Private Sub cmdDelete...

RMS Status Codes
Just wondering if anyone has a list of what the RMS Batch.Status codes 0-15 mean? I can't find them defined anywhere. I'm specifically looking at how to identify Blind Closes so I don't count them in totals until they'e been closed. Thanks! -Zim There is a Knowledge Base Article that covers the different Batch Status codes from 0 - 31. Just search for 'batch status codes' -- Robert Armstrong RMS Systems Inc. "Zim" <> wrote in message news:C72515DB-AD45-4C7D-B8DE-0A18E4A6D0D0@micr...

Excel worksheet with VBE codes don't work elsewhere
Hi, Some of my excel worksheets with embedded controls and VBA codes don' work when I open it on another PC. Is there another way to make i work? Thx -- lazybea ----------------------------------------------------------------------- lazybear's Profile: View this thread: Specifically what problems are you having? Saying "don't work" means absolutely nothing. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC ww...

retrieving folders.old file
probably been posted before, but need some help. i was getting the "MSIMN has caused an error in directdb.dll" i found the solution by renaming the folders.dbx file to folders.old. here's the problem, i opened express back up and my sent folder was empty. my question is, how or can i retrieve that old sent message list?? ...

outlook can't receive exe files
A guy here at work can't get exe files through his outlook. Is there a check to uncheck somewhere to allow it to do this? He can receive normal attachments. ...

Need code snippet to read offline PST file
Hi friends, I have a PST file in my local hard disk and have requirement to read PST file and parse through all folders and then each message item in all folders and then segregate them to different folders based on subject line. Please kindly send the code for the above requirement. Thanks & Regards Ramesh -- ramserp You're going to have to write your own code. Do you know anything about Outlook programming at all? You can start out by looking at information and code samples at -- Ken Slovak [MVP - Outlook] http://www.slo...

I do not have access to the D: drive from Publisher, why?
I do not have access to the D: drive from Publisher, why? It keeps saying "incorrect function" khaganman <> was very recently heard to utter: > I do not have access to the D: drive from Publisher, why? It keeps > saying "incorrect function" Is the D: drive your CD drive? -- Ed Bennett - MVP Microsoft Publisher ...

entourage on a thumb drive
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: pop Can you run entourage on a thumb drive?? I have a business email account I want to only keep on a thumb drive. Help???? > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3342347045_40807 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit On 11/28/09 9:44 PM, in article 59badca1.-1@webcrossing.JaKIaxP2ac0, "" <tl...

Excel 2000 vs. Excel 2002
I am having troubles with a workbook that I created that is havin problems opening. I created it in 2002, and it opens fine in Excel 2002 for other people However, when I send it to someone who has Excel 2000, it takes over a hour to open. Now I also made a very similar report that works just fine whe trasferred to excel 2000. Here are a couple of stats on the workbook that is having problems: 1.5mb 500+ externel links 500+ subtotals 200+ simple calculations (a1+b1; a1/b1;etc..) 1 Worksheet in the book. 2 columns with conditional formatting Thanks, Joh -- Message posted from http://ww...

Here is one for you experts - I am a novice I want to add a macro to a worksheet that will print selected information held on certain rows of the worksheet. Once the 'button' has been selected a mesage box will pop up asking the user to input which row number he/she wishes to print. On input that number is matched to the corresponding row of the worksheet and that row is copied (without any formula - just cell values) and pasted into another worksheet where it is placed into other formats and printed. Seems like a simple(!!) job - but far to difficult for me to programme Can an...

Any FREAKIN' way to import DBX files into Outlook 2003
I've tried: Importing via Outlook | Import from another Program or File Importing via Outlook | Import Internet Mail and Addresses Exporting from Outlook Express Tried Many, many times... Can Microsucks make this any more complicated... It's a FREAKIN' DBX file collection NO - No other Application has it Open. YES - The Files ARE there YES - the Internet Account IS there Yes - I've wasted more of my time IMPORTING into Outlook Express in VISTA just to RE-EXPORT back to Outlook. What a bunch of freakin' idiots... Another 2 hours wasted - because one Microsoft applica...

disable Review toolbar which came up automatically when opening a.
How can I disable the Review Toolbar which comes up automatically when opening a file? In the Workbook VBA actions. The top left hand corner there is an Excel logo, not the one in th blue program bar, but in the menu bar. Right Click and select "View Code" There will be two drop down boxes one that will probably say General if this has never been entered previously. Change the box on the right to Workbook. Then Change the right hand box to "Activate" Insert the following code Application.CommandBars("Reviewing").Visible = False exit the VBA screen and t...

Office 2004 issue with documents NOT BEING ABLE TO OPEN APPLICATION, but application can open documents.
BACKGROUND: Just migrated all my files and apps from a G4-400 to a new Mac Mini 1.87ghz Intel running pre-installed OSX10.4.10. Used CD to install 'normal' version of Office 2004 Mac on the new Mac Mini. In fact its the same disk that I used originally to install Office on the G4-400. PROBLEM: Neither old .xls and .doc documents (made on old Mac, nor new .xls and ..doc documents (made on new Mac)will not open their respective applications, when clicked upon. ADDITIONAL INFO: However, when I use either of the the application's "Open" feature, theres is no pr...

Opening .prn files in XL2000
I am using a software that does not save data/reports in .csv or .xls formats; only in printed versions. Is there a way to save the printed report in a file and open the file in XL2000? If there is, how is the print file produced, where is it saved, etc? A friend suggested setting up a generic printer but didn't know how to go about it. You may want to give that other software just one more chance--look under File and see if there is a SaveAs option. You may find something upon further review. But if you want to add a generic printer, I think it'll depend on your version of win...