Move an email from outlook to a local folder

Posted on 2011-04-27
Last Modified: 2012-05-11
I am trying to move an email from an outlook folder to a local folder on my C drive, but i suspect that i am doing it wrong.

Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim mf As Outlook.MAPIFolder
Dim m As Outlook.MailItem
Dim destfolder As String

Set m = mf.Items.Item(i)
destfolder = "c:\test"

m.Move destfolder

What am I doing wrong?
Question by:mjelec
    LVL 20

    Accepted Solution

    Hi mjelec

    The Move method is for moving an Outlook item to a different *Outlook* folder.

    You need to use the SaveAs method:

    m.SaveAs <filepath>, <type>

    <filepath> should be the full path to the output file (folder and filename)
    <type> is the format of the output file - it could be one of olHTML, olMSG, olRTF, olDoc, olTXT

    More info here:

    -- Graham

    Author Comment

    Alright that seemed to work but now I get a runtime error:

    "Cannot write to file: C:\test.  Right-click the folder that contains the file you want to, and then click the properties on the shortcut menu to check your permissions for the folder."

    I cant seem to find any properties, this is just a folder on my c: drive.  I am using the code:

    destfolder = "c:\test"
    m.SaveAs destfolder, olMSG

    Author Comment

    Wait I missed the File name part, it works.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Set OWA language and time zone in Exchange for individuals, all users or per database.
    Outlook Free & Paid Tools
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    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…

    754 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

    17 Experts available now in Live!

    Get 1:1 Help Now