?
Solved

Outlook 2003 Question

Posted on 2006-11-08
4
Medium Priority
?
191 Views
Last Modified: 2010-04-08
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
Comment
Question by:Will Szymkowski
[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
  • 2
4 Comments
 
LVL 97

Expert Comment

by:war1
ID: 17902654
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
 
LVL 76

Expert Comment

by:David Lee
ID: 17903309
Greetings, Spec01.

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

Cheers!
0
 
LVL 53

Author Comment

by:Will Szymkowski
ID: 17906824
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
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 total points
ID: 17929206
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

800 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