Solved

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

Posted on 2004-10-14
8
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

749 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