Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Outlook 2003 Question

Hello Experts,

I have a user that wants to be able to transfer an email to a specific folder automatically after the email has been read. Is this possible?

Any comments would be appreciated.
0
Will Szymkowski
Asked:
Will Szymkowski
  • 2
1 Solution
 
war1Commented:
Greetings, Spec01 !

You can create a rule to move email to a specific folder, then read the email from there. But there is nothing natively within Outlook that will move the email after you read it.

Best wishes!
0
 
David LeeCommented:
Greetings, Spec01.

It might be possible with a bit of Outlook scripting.  Is that an option?

Cheers!
0
 
Will SzymkowskiSenior Solution ArchitectAuthor Commented:
Thanks for the fast responses. Unfortunitly I don't have mych back ground on scripting. Is it possible for someone to create a script or another way around this issue?

Any help is appreciated. I will also increase the point value to 500pts
0
 
David LeeCommented:
Spec01,

There doesn't seem to be a good solution for doing this.  I tried several possibilities and this one works the best.  It does have a flaw though.  If the user opens more than one message at a time, then it will only work for the last item opened.  Follow these instructions to use this.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor.
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession.
4.  Copy the code and paste it into the right-hand pane of the VB Editor window.
5.  Edit the code as necessary.  I've placed comments where things need to change.
6.  Click the diskette icon on the toolbar to save the changes.
7.  Close the VB Editor.
8.  Click Tools->Macro->Security.
9.  Set the Security Level to Medium.
10.  Close Outlook.
11.  Start Outlook.
12.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

I have not tested this thoroughly.  I tested enough to verify that it moves a read mail item when the message window is closed.

Dim WithEvents olkInspectors As Outlook.Inspectors, _
    WithEvents olkInspector As Outlook.Inspector, _
    objItem As Object

Private Sub Application_Startup()
    Set olkInspectors = Application.Inspectors
End Sub

Private Sub olkInspector_Close()
    If objItem.Class = olMail Then
        If objItem.UnRead = False Then
            'On the following line change the path of the Outlook folder that read items are to be moved to.
            objItem.Move OpenMAPIFolder("\Some Mailbox or Folder\Some Sub-folder")
        End If
    End If
End Sub

Private Sub olkInspectors_NewInspector(ByVal Inspector As Inspector)
    Set olkInspector = Application.ActiveInspector
    Set objItem = olkInspector.CurrentItem
End Sub

'Credit where credit is due.
'The code below is not mine.  I found it somewhere on the internet but do
'not remember where or who the author is.  The original author(s) deserves all
'the credit for these functions.
Function OpenMAPIFolder(szPath)
    Dim app, ns, flr, szDir, I
    Set flr = Nothing
    Set app = CreateObject("Outlook.Application")
    If Left(szPath, Len("\")) = "\" Then
        szPath = Mid(szPath, Len("\") + 1)
    Else
        Set flr = app.ActiveExplorer.CurrentFolder
    End If
    While szPath <> ""
        I = InStr(szPath, "\")
        If I Then
            szDir = Left(szPath, I - 1)
            szPath = Mid(szPath, I + Len("\"))
        Else
            szDir = szPath
            szPath = ""
        End If
        If IsNothing(flr) Then
            Set ns = app.GetNamespace("MAPI")
            Set flr = ns.Folders(szDir)
        Else
            Set flr = flr.Folders(szDir)
        End If
    Wend
    Set OpenMAPIFolder = flr
End Function

Function IsNothing(obj)
  If TypeName(obj) = "Nothing" Then
    IsNothing = True
  Else
    IsNothing = False
  End If
End Function
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now