Solved

Move email to folder, need to display more than subject as filename

Posted on 2004-10-14
8
299 Views
Last Modified: 2011-10-03
OK, here is what im doin...  need to move emails from my inbox to a folder on my hard drive.   When I just click and drag the emails it works fine, but it changes the file name to the subject.  I would need to display at least sender and subject as filename.

Any ideas?

I can not find any settings to change this, but I'm sure I'm just looking in the wrong place.

Thanks!
0
Comment
Question by:skwash
  • 4
  • 3
8 Comments
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 125 total points
ID: 12317721
I think you will need to have a MACRO to save the items via code. The following MACRO will save all the mail items in a selected folder to C:\temp, with the file name formated as "From - (SenderName) - (Subject).msg

Sub SaveAsOlMSG()
   
    'Declare Objects & Variables
    Dim oOutlook As Outlook.Application
    Dim oNs As Outlook.NameSpace
    Dim oFldr As Outlook.MAPIFolder
    Dim oMessage As Object
    Dim oSfMsg As Redemption.SafeMailItem
    Dim oMBox As String
    Dim oSubject As String
    Dim oSbjAlpha As String
    Dim ctr As Integer
   
    'Setup the object variables
    Set oOutlook = New Outlook.Application
    Set oNs = oOutlook.GetNamespace("MAPI")
    oMBox = MsgBox("Select the folder containg the message items you wish to save:", vbOKOnly)
    Set oFldr = oNs.PickFolder
    Set oSfMsg = CreateObject("Redemption.SafeMailItem")

oSfMsg.AuthKey = "str8isTheg8"

    For Each oMessage In oFldr.Items
            oSfMsg.Item = oMessage
            ctr = 1
            oSbjAlpha = ""
            While ctr < (Len(oSfMsg.Subject) + 1)
                If Mid(oSfMsg.Subject, ctr, 1) Like "[A-Za-z( )]" Then
                    oSbjAlpha = oSbjAlpha & Mid(oSfMsg.Subject, ctr, 1)
                ElseIf Val(Mid(oSfMsg.Subject, ctr, 1)) > 0 Then
                    oSbjAlpha = oSbjAlpha & Mid(oSfMsg.Subject, ctr, 1)
                ElseIf Mid(oSfMsg.Subject, ctr, 1) = "0" Then
                    oSbjAlpha = oSbjAlpha & Mid(oSfMsg.Subject, ctr, 1)
                ElseIf Mid(oSfMsg.Subject, ctr, 1) = "." Then
                    oSbjAlpha = oSbjAlpha & Mid(oSfMsg.Subject, ctr, 1)
                Else
                    oSbjAlpha = oSbjAlpha & " "
                End If
                ctr = ctr + 1
            Wend
            oSfMsg.SaveAs "C:\Temp\From - " & oSfMsg.SenderName & " - " & oSbjAlpha & ".msg", olMSG
            'oMessage.Move oToFldr
    Next oMessage
   
    Set oOutlook = Nothing
    Set oNs = Nothing
    Set oFldr = Nothing
    Set oSfMsg = Nothing
   

End Sub
0
 

Author Comment

by:skwash
ID: 12321426
I think you are probably right but  I am getting an error saying "compile error: user defined type not defined"  

This happens at:

    Dim oSfMsg As Redemption.SafeMailItem

I'm running Outlook 2003 if that makes a difference.  I have never created macro's in outlook so mabey I'm doing something wrong
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12321491
Sorry about that... I forgot to mention that in order to avoid the security warnings that outlook will throw when you save an email to disk via code I used the Outlook Redemption library. You can download Outlook Redemption from here:
http://www.dimastr.com/redemption/

If you install that (And set a reference to "SafeOutlook Library") it should run without the error. You will also need to delete the line that says:

    oSfMsg.AuthKey = "str8isTheg8"

That line is custom specific to my setup but not required on a clean setup of Outlook Redemption.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:skwash
ID: 12321711
Awesome...  looks like it will work...  I'm gonna have to make some tweaks to the code to meet our needs but this looks great!

thanks for the help!
0
 

Author Comment

by:skwash
ID: 12321850
how would I delete the mail after it has been moved to the folder?

thx
0
 

Author Comment

by:skwash
ID: 12322564
nevermind, just added oMessage.delete :P
0
 
LVL 4

Expert Comment

by:Gal_atea
ID: 12323972
Glad I could help Skwash!
God bless!

Sam
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12323984
Oops... Sorry... I was using my Girlfriend's computer.

ThanX!

Sam
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

786 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