OL2007 - is there a way to disable the "feature" that cripples mails that are in the "junk" folder?

Not open for further replies.
As long as junk mail is going into the junk e-mail folder in the default data file, it should get picked up and moved.

Use this as the application_startup code - see if this brings up the dialog when Outlook starts (or when you click in the app start macro) - the message box may come up behind the splash screen - click on the taskbar icon to find it.

 Private Sub Application_Startup()
 Dim oFolder as Outlook.folder
Set oFolder = Session.GetDefaultFolder(olFolderJunk)
 Set Items = oFolder.Items
 MsgBox "Watching... " & oFolder.Name
 End Sub

This is the full macro I'm using - it's the same as the one you posted, but without the annoying message box each time a message hits the junk folder. And it has the updated application startup.

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim oFolder As Outlook.folder
Set oFolder = Session.GetDefaultFolder(olFolderJunk)
Set Items = oFolder.Items
MsgBox "Watching... " & oFolder.Name
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
' Set MovePst = Session.GetDefaultFolder(olFolderInbox).Parent.Folders("xPort\Zunk")
Set MovePst = GetFolderPath("xPort\Zunk")
Item.UnRead = False
Item.Move MovePst
End Sub

Function GetFolderPath(ByVal FolderPath As String) As Outlook.folder
Dim oFolder As Outlook.folder
Dim FoldersArray As Variant
Dim i As Integer

On Error GoTo GetFolderPath_Error
If Left(FolderPath, 2) = "\\" Then
FolderPath = Right(FolderPath, Len(FolderPath) - 2)
End If
'Convert folderpath to array
FoldersArray = Split(FolderPath, "\")
Set oFolder = Application.Session.Folders.Item(FoldersArray(0))
If Not oFolder Is Nothing Then
For i = 1 To UBound(FoldersArray, 1)
Dim SubFolders As Outlook.Folders
Set SubFolders = oFolder.Folders
Set oFolder = SubFolders.Item(FoldersArray(i))
If oFolder Is Nothing Then
Set GetFolderPath = Nothing
End If
End If
'Return the oFolder
Set GetFolderPath = oFolder
Exit Function

Set GetFolderPath = Nothing
Exit Function
End Function
k. copied yours.

when i start OL, i don't see the "Watching..." message box. but i DO see it if i run that code snippet from VBA-editor.

e.g. - perhaps the startup macro doesn't run on start?

could the below have anything to do with this - the default mail file is somehow corrupt - mostly it works, but it doesn't let me compact it, and doesn't get fixed with the repair PST utility.

What type of account is that? It really shouldn't matter...
That's what my test account is. I'm just not sure why you are getting that error message or if it's a factor in why this isn't working for you.
somehow i think that may be related to the code not working as the folders under the root on that file don't appear in the outlook folders list that i had posted above a few msgs back. but then Junk E-mail is anyway not a standard folder - which is why this whole thread exists !
hold on. it's WORKING after all !

not on mails that i manually move to Junk, but on newly arrived mails - which is the desired function anyway. just the startup notification does not appear.

the next improvement - how to flag the moved msgs unread in the ItemAdd -code snippet? i'd like to monitor on one glance how much junk has arrived.
Remove this line - Item.UnRead = False - or set it to true. This original purpose of this code was for sent items that were moved using a rule - they are marked Unread and it annoyed people.
k - removed that line. yes, that worked, i now get "unread" msgs @ \zunk.

but i was rejoicing too early - the macro only runs sometimes, not always. haven't been able to pin down what might be the rationale of that.

could it have something to do with the bug that displays the VBA editor?
No, I don't think so. It should run every time a message is dropped in the Junk mail folder. If the account was an exchange (and possibly outlook.com or imap), the macro could fail because the message is moved online, so Outlook doesn't see it being added. Another cause of failure is too many messages coming in at once.
however - it never ran/runs on messages that i move there manually, it sometimes now does on the incoming ones that come there from the outside mail server. no exchange, just a buncha pop3/smtp accounts. how to troubleshoot?
I've been thinking about it and don't understand why it's not running all the time.

Are you using separate data files? The macro only watches the junk folder in the default data file - if you have more than one that is used for delivery, the junk folder for those accounts is not going to be watched.
my junk folder is indeed in the default data file:
3/1/2015 5:02:12 PM: Selected Archive Name: CurrEmail
3/1/2015 5:02:12 PM: Total Number of Sub Folders: 10
3/1/2015 5:02:12 PM: \\CurrEmail\Deleted Items
3/1/2015 5:02:12 PM: \\CurrEmail\Contacts
3/1/2015 5:02:12 PM: \\CurrEmail\Drafts
3/1/2015 5:02:12 PM: \\CurrEmail\Inbox
3/1/2015 5:02:12 PM: \\CurrEmail\Junk E-mail
3/1/2015 5:02:12 PM: \\CurrEmail\Outbox
3/1/2015 5:02:12 PM: \\CurrEmail\Sent Items
3/1/2015 5:02:12 PM: \\CurrEmail\Calendar
3/1/2015 5:02:12 PM: \\CurrEmail\Tasks
3/1/2015 5:02:12 PM: \\CurrEmail\Notes

i'm still thinking that this could have something to do with the fact that "properties>advanced" is unavailable for the data file...
Is the CurrEmail data file a pst? If not, what type of email account created it?
Do you get any error messages when you try to use Properties > Advanced ? It should open a dialog but the dialog can vary.

Have you used scanpst on the data file?
the error message:

"The information service cannot be configured. Either the information service does not possess properties required for configuration, or the MAPI configuration file entry point could not be configured."

i run scanpst on the data file as a scheduled task every other night.
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Does the .fdm contain my custom form? How to make ol use it? - ol2007 Outlook VBA and Custom Forms 4
E OL2007 on Exchange: opening OL on different computers Using Outlook 1
R Multiple instances of OL2007 and creating rules Exchange Server Administration 1
P OL2007 -- All day appt. end time is "tomorrow" Using Outlook 3
T Search for multiple contacts in OL2007 Using Outlook 3
M Develop for OL2003 on OL2007 machine using VS2008 and VSTO? Outlook VBA and Custom Forms 1
M OL2007 Add-in won't install on OL2010 Outlook VBA and Custom Forms 1
P Embed Word doc w/form into OL2007 form Outlook VBA and Custom Forms 1
N Right-click an address -> add to BCM? [OL2007] BCM (Business Contact Manager) 1
J Deploying OL2007 Add-In Outlook VBA and Custom Forms 3
A How to replace getcontactsfolder (ol2007) in Outlook 2003 Outlook VBA and Custom Forms 2
P Redemption not working on OL2007 Outlook VBA and Custom Forms 2
J disable Alt+S shortcut Using Outlook 21
J Hide/disable "Groups", "Shared Calendars" Using Outlook 2
G To enable/disable Allow New Time proposals Outlook VBA and Custom Forms 1
Y Disable Microsoft Outlook Test Message Using Outlook 4
J How do you disable address search box when typing @ in body of email? Using Outlook 0
L Is there a way to completely disable the "archive" box? Using Outlook 1
M Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 7
U Disable "Always ask before opening" Dialog Using Outlook 3
J How do I disable advertising in Outlook 2019? Using Outlook 15
GregS Outlook 2016 Can I disable the Outlook Outbox? Using Outlook 2
R Disable conversation thread from replying of recipients in the same subject. Please help Using Outlook 0
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
N How to disable shortcuts for Pilcrow in Outlook (Show or hide paragraph marks) Using Outlook 0
N How to disable shortcuts for Pilcrow in Outlook Using Outlook 0
M Making Subject field writable (disable Read Only) Outlook VBA and Custom Forms 2
D Disable or hide "reply" and "reply to all" and "forward" in email from access vba Outlook VBA and Custom Forms 1
P Disable Spam Notifications & Sounds Using Outlook 3
O Outlook Web Access - how to disable spam filter Using Outlook 6
Diane Poremsky Disable Protected View for Outlook Attachments Using Outlook 0
E Outlook 2010 disable date auto-complete Using Outlook 2
Diane Poremsky Disable Outlook Add-ins (Apps) Using Outlook 0
J Using VBA to disable alerts / warnings Using Outlook 2
Diane Poremsky Disable the Unsafe Hyperlink Warning when Opening Attachments Using Outlook 0
N How to disable user defined fields in BCM forms Using Outlook 2
Diane Poremsky Disable Live Preview in Outlook and Word Using Outlook 0
D Preventing users to disable an Outlook Add-in Using Outlook.com accounts in Outlook 5
F Disable "Find related messages" Using Outlook 1
davecazz Anyway to disable the peek rollovers? Using Outlook 1
L Reading Pane - COMPLETELY DISABLE? Using Outlook 10
M trying to disable junk email filter. completely. Using Outlook 4
B How do I REALLY disable Outlook Junk E-mail sorting in OL2010 and/or 2013? Using Outlook 1
R Outlook Cache Mode Terminalserver disable through Registry Using Outlook 1
S Cannot disable OWA light Exchange Server Administration 5
A How to disable the pop-up “Reponses to this meeting will not be tallied." Using Outlook 0
D Show this folder as an e-mail Address Book is enabled but I want to disable Using Outlook 2
Rupert Dragwater how to disable billingual dictionary in outlook 2010 Using Outlook 9
J How to disable syncing folder views/layouts Using Outlook 5
A Disable hotmail from Outlook email account Using Outlook 1

Similar threads