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

x
?
Solved

Outlook 2003 rules not running automatically

Posted on 2008-10-07
8
Medium Priority
?
1,778 Views
Last Modified: 2013-11-29
Hello,
  Hopefully someone can help me make sense of this.

I am using Outlook 2003, connecting to our Exchange Server.
To help cut down on my mailbox size, I created a rule to check when mail is sent to move sent items to a local .PST folder.  However, this rule does not run automatically after I send an email but works when I clicked to run rules now.
Would anyone know why this is so?

Thanks
0
Comment
Question by:genius2x
[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
  • 4
8 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 22662153
Hi, genius2x.

Rules only run when items are sent or received.  They cannot be made to run when an item is moved.  
0
 

Author Comment

by:genius2x
ID: 22669060
Hi BlueDevilFan, Thanks for the quick response.
 Can you suggest a way for Sent Items to be moved automatically to a local folder (.pst folder) without having to resort to using Sent Items Organizer?
http://www.sperrysoftware.com/Outlook/Sent-Items-Organizer.asp
0
 
LVL 76

Expert Comment

by:David Lee
ID: 22674646
Do the sent items need to go to a single folder or multiple folders?  If multiple folders, how many and how would a solution determine which folder to move an item to?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:genius2x
ID: 22675468
Just one folder.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 22676730
No need to purchase an add-in.  We can do this with a fairly simple bit of scripting, like the code below.  Follow these instructions to set up and use the code.

  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 from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
  5. Edit the code as needed.  I included comment lines wherever something needs to or can 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.
That's it.  When you send an item the sent items copy will be moved to the designated folder.  Keep in mind that this will move every sent item to this folder.

Private WithEvents olkSentItems As Outlook.Items
Private olkFolder As Outlook.MAPIFolder
 
Private Sub Application_MAPILogonComplete()
    Set olkSentItems = Session.GetDefaultFolder(olFolderSentMail).Items
    'Edit the folder path on the following line.  A folder path in Outlook is just like a folder path in the file system, only without the drive letter.'
    Set olkFolder = OpenOutlookFolder("Personal Folders\My Folder\My Sub-folder")
End Sub
 
Private Sub Application_Quit()
    Set olkSentItems = Nothing
    Set olkFolder = Nothing
End Sub
 
Private Sub olkSentItems_ItemAdd(ByVal Item As Object)
    Item.Move olkFolder
End Sub
 
Function IsNothing(obj)
  If TypeName(obj) = "Nothing" Then
    IsNothing = True
  Else
    IsNothing = False
  End If
End Function
 
Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        olkFolder As Outlook.MAPIFolder
    On Error GoTo ehOpenOutlookFolder
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        If Left(strFolderPath, 1) = "\" Then
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        End If
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            If IsNothing(olkFolder) Then
                Set olkFolder = Session.Folders(varFolder)
            Else
                Set olkFolder = olkFolder.Folders(varFolder)
            End If
        Next
        Set OpenOutlookFolder = olkFolder
    End If
    On Error GoTo 0
    Exit Function
ehOpenOutlookFolder:
    Set OpenOutlookFolder = Nothing
    On Error GoTo 0
End Function

Open in new window

0
 

Author Comment

by:genius2x
ID: 22678432
Hi BlueDevilFan,
  Thank you for the code.  Sorry for being a Macros idiot, but looks like i'm doing something wrong with code.

Debugger shows that there is an error on the following line:
                                     Item.Move olkFolder
Private WithEvents olkSentItems As Outlook.Items
Private olkFolder As Outlook.MAPIFolder
 
Private Sub Application_MAPILogonComplete()
    Set olkSentItems = Session.GetDefaultFolder(olFolderSentMail).Items
    'Edit the folder path on the following line.  A folder path in Outlook is just like a folder path in the file system, only without the drive letter.'
    Set olkFolder = OpenOutlookFolder("outlooksentpst\PersonalSentFolder.pst")
End Sub
 
Private Sub Application_Quit()
    Set olkSentItems = Nothing
    Set olkFolder = Nothing
End Sub
 
Private Sub olkSentItems_ItemAdd(ByVal Item As Object)
    Item.Move olkFolder
End Sub
 
Function IsNothing(obj)
  If TypeName(obj) = "Nothing" Then
    IsNothing = True
  Else
    IsNothing = False
  End If
End Function
 
Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        olkFolder As Outlook.MAPIFolder
    On Error GoTo ehOpenOutlookFolder
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        If Left(strFolderPath, 1) = "\" Then
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        End If
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            If IsNothing(olkFolder) Then
                Set olkFolder = Session.Folders(varFolder)
            Else
                Set olkFolder = olkFolder.Folders(varFolder)
            End If
        Next
        Set OpenOutlookFolder = olkFolder
    End If
    On Error GoTo 0
    Exit Function
ehOpenOutlookFolder:
    Set OpenOutlookFolder = Nothing
    On Error GoTo 0
End Function

Open in new window

sentfolder.JPG
0
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 total points
ID: 22678783
No problem. The folder path is invalid.  The path is the path to the folder inside Outlook, not to the .pst file in the file system. Outlook folder paths are just like file system folder paths in that they are built by joining the names of all the folders between the root and destination folders separated by a \ character. Consider a folder structure that looks like this in Outlook

Personal Folders
  + Folder 1
       + Sub-folder A
       + Sub-folder B
  + Folder 2
       + Sub-folder C

The path to "Folder 1" is "Personal Folders\Folder 1"
The path to "Sub-folder C" is "Personal Folders\Folder 2\Sub-folder C"

You need to use path in Outlook to the folder you want the items to go into.
0
 

Author Closing Comment

by:genius2x
ID: 31503858
Excellent!!
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

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…
Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Suggested Courses

661 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