this bit of code is doing something weird.
doing the doc.putinfolder, isn’t really moving the emails to the desired folder…it’s creating a stub at the location and the email still remains in the inbox.
If I delete the email from the inbox…it disappears from the desired folder… this has worked just fine for 8 years, but this year, it just created stubs…
Any idea?
Here is the simple script…
Sub Initialize
’ Move emails to a folder based on year. This way inbox keeps clean for this mail-in database
’ Runs on the 2nd day of january.
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim lookupView As NotesView
Dim newView As NotesView
Dim doc As NotesDocument
Dim currentYear as New NotesDateTime( Now )
Dim item As NotesItem
Dim i As integer
Dim thisYear As String
Dim docYear As String
Set db = s.Currentdatabase
Set view = db.Getview(“($Inbox)”)
thisYear = StrRightBack( currentYear.Dateonly, “/” )
i=0
Set doc = view.Getfirstdocument()
While Not (doc Is Nothing)
Set item = doc.GetFirstItem ( “DeliveredDate” )
docYear = StrRightBack ( item.Datetimevalue.Dateonly, “/”)
If ( docYear = thisYear) Then
GoTo skip
Else
Call doc.Putinfolder( docYear, true )
End If
skip:
i = i + 1
Set doc = view.Getnextdocument(doc)
Wend
done:
End Sub
Thanks…
(edit… apparently used MS Edge cause double posts…sorry about that)
Subject: up to date
Domino is fully up to date…
I didn’t debug it because it so freakin simple…
I guess I’ll open a support ticket.
Subject: Try adding RemoveFromFolder to remove from Inbox
I have no idea why your code’s behaviour would have changed, but you could try adding this line to remove the document from the Inbox after adding it to the other folder:
Call doc.RemoveFromFolder(“($Inbox)”)
This assumes the Inbox is a folder, which is the case if your code works on a standard Domino mail file.
Subject: Not just an MS Edge problem…
I use IE and get double posts too. I contacted the site admins months ago…no change in behavior.
So the code hasn’t changed in 8 years. I anything else different? New OS, Domino patch level different, anything?
Have you run the code with the debugger on to see how the code executes in the front end?
If you’ve done patching to Domino since the last agent run, you may want to submit a PMR to IBM, system might be borked.
Subject: I don’t know what you mean by stubs, but …a couple of thoughts.
If you need to remove something from the Inbox, I would expect to find a NotesDocument.RemoveFromFolder() call.
In the target folder – has it been changed to show documents in hierarchy, e.g.? Because if it has, it could get tangled up when you run NotesDocument.PutInFolder() on a response doc (that is, a doc with a $Ref field).
And what’s your default folder design? If it changed to a hierarchical view, that’d account for a lot.
I’d expect the partial-hierarchies switch might also have some heartburn over moving only responses to the folder, but I’m not sure exactly how it’s impacted.