When we access his mail file we see all of his documents in the inbox. Even the ones that he has filed away into folders. (I know this is the case as I can ‘read’ one of the docs in the inbox and track it in his folders and of course it is ‘read’)
We have searched everywhere, called IBM and raised a PMR and basically we still have no solution. I have been led to believe that it is to do with the links in the $Inbox design element
My cry is to all you developers out there (I am but a humble admin) to see if anyone can help me!
I would like an agent that checks every message in the inbox and compares it to every message in the users folders. If it finds a match in the folder, it ‘removes’ it from the inbox and leaves it in the folder.
The logic is simple. But unfortunately so are my design skills. Does anyone think they are up to solve this challenge?
Subject: RE: Inbox showing ‘filed’ documents. Developers help wanted! (please
If there are not a lot of folders, it’s not hard to do this manually; go to a folder, select all. Hold down Ctrl while you click the Inbox folder. Any documents that are still selected in the Inbox, are also in the folder you were just in.
Otherwise, you can do it with code, but it might be slow. If folder references are enabled in the database, and if they were enabled at the time the documents got into the folders that they’re in (besides the inbox) then you should be able to use a script like this to check each inbox document for membership in other folders.
Set view = db.GetView(“($Inbox)”)
Set doc = view.GetFirstDocument
Do Until doc Is Nothing
Set nextdoc = view.GetNextDocument(doc)
i = 0
On Error 549 Goto noreferences
Forall FolderReference In doc.FolderReferences
If FolderReference <> "" And FolderReference <> "($Inbox)" Then
i=i+1
End If
End Forall
If i <> 0 Then
Call doc.RemoveFromFolder("($Inbox)")
End If
resumeLoop:
Set doc = nextdoc
Loop
Exit Sub
noreferences:
Resume resumeLoop
If folder references are not enabled, then you could try something like this, which is slower but should still work:
Subject: RE: Inbox showing ‘filed’ documents. Developers help wanted! (please
Hi Andre,
The CTRL select method works a treat for small mail boxes.
I am having a lot more trouble with the coded version. Time is not a problem here, so if the agent works and it is the simplest thing to execute, then that is probably the way we will go…
First question:
When I create the agent do I do so using LotusScript or Formula? Currently I have selected formula.
Second question…
Is the syntax correct?
When I put the code you mentioned (either lot) in the agent i get an error that says:
An operator or semicolon wasexpected but none encountered: ‘view’
The word view is in red after the word Set on the very first line.
As I said… I am no developers armpit so any help you can provide is greatly appreciated.
Subject: Inbox showing ‘filed’ documents. Developers help wanted! (please
Michael, try this code I wrote for someone suffering the exact same problem. Copy and paste it to an agent in the mail file, run from actions menu, target all documents in database:Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim inboxView As NotesView
Dim inboxVC As NotesViewEntryCollection
Dim inboxEntry As NotesViewEntry
Dim inboxDoc As NotesDocument
Dim folderView As NotesView
Dim viewArray() As Variant
Dim vc As NotesViewEntryCollection
Dim folderEntry As NotesViewEntry
Dim folderDoc As NotesDocument
Dim nextEntry As NotesViewEntry
Dim i,x,remcount As Integer
Set db = session.CurrentDatabase
'build a dynamic array of all folders in the database
Dim vCount As Integer
vCount = 0
Forall v In db.Views
If v.IsFolder Then
If Not (v.Name="($Inbox)") And Not (v.Name="($Trash)") Then
Redim Preserve viewArray(vCount)
viewArray(vCount) = v.Name
vCount = vCount + 1
End If
End If
End Forall
' get the collection of docs in the inbox
Set inboxView = db.GetView("($Inbox)")
Set inboxVC = inboxView.AllEntries
' get the first entry
Set inboxEntry = inboxVC.GetFirstEntry
Set inboxDoc = inboxEntry.Document
' loop through all of them
remcount = 0
While Not (inboxDoc Is Nothing)
For x = 0 To Ubound(viewArray)
Set folderView = db.GetView(viewArray(x))
' look for the current document in this folder
Set vc = folderView.AllEntries
Set folderEntry= vc.GetEntry(inboxEntry)
If Not (folderEntry Is Nothing) Then
' found a match
Set folderDoc = folderEntry.Document
If folderDoc.Form(0) = "Memo" Or folderDoc.Form(0)="Reply" Then
'it's definitely an email
' If Msgbox("Found an email:" & Chr(10) & Chr(10) & "From: " & inboxDoc.From(0) &_
' Chr(10) & "Subject: " & inboxDoc.Subject(0) & Chr(10) & "Folder: " &_
' folderView.Name & Chr(10) & Chr(10) &_
' "Would you like to remove it from your inbox?", 4+32, "Found Match") = 6 Then
' user wants to remove it
' Set NextEntry = inboxVC.GetNextEntry(inboxEntry)
' Call inboxDoc.RemoveFromFolder("($Inbox)")
’ Set inboxEntry = NextEntry
' Goto nextdoc
' Else
' user wants to keep it
' End If
Set NextEntry = inboxVC.GetNextEntry(inboxEntry)
Call inboxDoc.RemoveFromFolder("($Inbox)")
remcount = remcount + 1
Set inboxEntry = NextEntry
End If ' doc is not an email
End If ' could not find it
Next x
' there was no match in any folder, so move to the next document in the inbox
Set inboxEntry = inboxVC.GetNextEntry(inboxEntry)
nextdoc:
If Not (inboxEntry Is Nothing) Then
Set inboxDoc = inboxEntry.Document
Else
Set inboxDoc = Nothing
End If
Wend
Msgbox "Folder Scan Agent removed " & Cstr(remcount) & " documents from your Inbox."
End Sub
Some of the lines will appear “green” as they are not in use. If you remove the apostrophe’s before the green lines, the code will prompt you every time it finds a match in another folder.
Subject: RE: Inbox showing ‘filed’ documents. Developers help wanted! (please
Thanks Ben,
This one ‘works’ straight out of the box.
It did not remove all pointers in one go, I had to run the agent about 10 times (to relocate about 460 pointers) and at the end when it was reporting no more objects to move there were still a few messages in the inbox.
But the agent has saved us loads of time and we are keeping it aside in case we experience the problem again.