Error : Mails found in all document instead of In-box
Use below given lotus script agent and run from user mail file .
Sub Click(Source As Button)
Dim s As New notessession
Dim db As notesdatabase
Dim fDoc As NotesDocument ' Document in folder
Dim ad As notesview ' All Documents view
Dim aDoc As notesdocument ' document in All Docs view
Dim fUNID() As String ' array of UNID's of docs in folders
Dim i As Integer ' UNID array index
Dim MailCount As Integer
Dim LoopCount As Double
i =0
MailCount = 0
LoopCount = 0
Set db = s.CurrentDatabase
' Build UNID array by looping through folders, then their documents
Forall view In db.views
If view.IsFolder And Not view.Name=("($All)") Then
Print "Scanning - " & view.name
Set fDoc = view.GetFirstDocument
While Not fDoc Is Nothing
LoopCount = LoopCount + 1
Redim Preserve fUNID(i)
fUNID(i) = fDoc.UniversalID
i=i+1
Set fDoc = view.GetNextDocument(fDoc)
Wend
End If
End Forall
' Loop through docs in the All Documents view and compare UNIDs to each doc
in the array
Print "Adding documents to the Inbox"
Set ad = db.GetView("($All)")
Set aDoc = ad.GetFirstDocument
While Not aDoc Is Nothing
i = 0
Do While i <= Ubound(fUNID)
LoopCount = LoopCount + 1
If fUNID(i) = aDoc.UniversalID Then
Exit Do
End If
i = i + 1
Loop
If i > Ubound(fUNID) And (adoc.form(0) = "Memo" Or adoc.form(0) = "Reply"
Or adoc.form(0) = "Reply With History") And adoc.DeliveredDate(0) <> "" Then
MailCount = MailCount + 1
Print MailCount & " documents added to inbox"
Call adoc.PutInFolder( "($Inbox)")
End If
Set aDoc = ad.GetNextDocument(adoc)
Wend
Messagebox"Process completed. "
End Sub
Use below given lotus script agent and run from user mail file .
Sub Click(Source As Button)
Dim s As New notessession
Dim db As notesdatabase
Dim fDoc As NotesDocument ' Document in folder
Dim ad As notesview ' All Documents view
Dim aDoc As notesdocument ' document in All Docs view
Dim fUNID() As String ' array of UNID's of docs in folders
Dim i As Integer ' UNID array index
Dim MailCount As Integer
Dim LoopCount As Double
i =0
MailCount = 0
LoopCount = 0
Set db = s.CurrentDatabase
' Build UNID array by looping through folders, then their documents
Forall view In db.views
If view.IsFolder And Not view.Name=("($All)") Then
Print "Scanning - " & view.name
Set fDoc = view.GetFirstDocument
While Not fDoc Is Nothing
LoopCount = LoopCount + 1
Redim Preserve fUNID(i)
fUNID(i) = fDoc.UniversalID
i=i+1
Set fDoc = view.GetNextDocument(fDoc)
Wend
End If
End Forall
' Loop through docs in the All Documents view and compare UNIDs to each doc
in the array
Print "Adding documents to the Inbox"
Set ad = db.GetView("($All)")
Set aDoc = ad.GetFirstDocument
While Not aDoc Is Nothing
i = 0
Do While i <= Ubound(fUNID)
LoopCount = LoopCount + 1
If fUNID(i) = aDoc.UniversalID Then
Exit Do
End If
i = i + 1
Loop
If i > Ubound(fUNID) And (adoc.form(0) = "Memo" Or adoc.form(0) = "Reply"
Or adoc.form(0) = "Reply With History") And adoc.DeliveredDate(0) <> "" Then
MailCount = MailCount + 1
Print MailCount & " documents added to inbox"
Call adoc.PutInFolder( "($Inbox)")
End If
Set aDoc = ad.GetNextDocument(adoc)
Wend
Messagebox"Process completed. "
End Sub
Manoj Sir,thanks for your post .This is very useful script.
ReplyDeleteThanks a lot.