Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-14
8
Medium Priority
?
304 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 500 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

715 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