Hi All,
I am facing a problem , here with mail journalling files that’s being created automatically after the max size of MailJrn.nsf exceeds 500 MB in size. The problem that I am facing is how to get the Mailjournal files that have been created automatically and loop through and get the documents based on certain criteria and copy to another database.
I have written a code that picks up documents from mailjrn.nsf file on a dailybasis and copies the code into another database , but how to get the last created mail journal file say mj000012.nsf and do the same thing.
I am looking for a handle to get the last generated mail journal file.
Here is my code to get the certain documents from MailJrn.nsf and copied to another database.
Please help
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim contview As NotesView
Dim contdoc As NotesDocument
Dim doc As NotesDocument
Dim username As NotesName
Dim username1 As NotesName
Dim str1 As String
Dim item1,item2,item3,item4,item5 As NotesItem
Dim nname As String
Dim date1 As NotesDateTime
Dim date2 As String
Dim a1, a2,a3,a4,a5 As NotesItem
Dim d1,d2,d3,d4,d5 As NotesItem
Dim lndb As NotesDatabase
Dim lookupview As NotesView
Dim lndbcontview As NotesView
Dim lndbcontdoc As Notesdocument
Dim jndb As NotesDatabase
Dim jndbcontview As NotesView
Dim jndbcontdoc As Notesdocument
Dim str2 As String
Dim firstdoc As NotesDocument
Dim dc As NotesDocumentCollection
Dim dd1 As Variant
Dim finddb As NotesDatabase
Dim templateDb As NotesDatabase
Dim templateName As String
Dim size As Double
Dim dbdir As NotesDbDirectory
Dim path1 As String
Dim len1 As Integer
Dim len2 As Integer
Set db = session.CurrentDatabase
Set dbdir = session.GetDbDirectory("NotesNYC")
'Set templateDb = New NotesDatabase( "NotesNYC", "mailjrn\mailjrn.nsf" )
'templateName = templateDb.TemplateName
Set finddb = dbdir.GetFirstDatabase( DATABASE )
While Not finddb Is Nothing
path1 = finddb.FilePath
len1 = Len(finddb.FilePath)
len2 = Len(finddb.FileName) + 1
If len1 > len2 Then
path1 = Left$(path1, len1-len2)
Print path1
If path1 = "Mailjrn" Then
If finddb.Title = "Mail Journaling (7)" Then
Call finddb.open(finddb.Server, finddb.FilePath)
If finddb.Filename = "mailjrn.nsf" Then
Set contview = db.GetView("vwAdminControl")
Set contdoc = contview.GetFirstDocument
Set lndb = New NotesDatabase(db.server, "names6.nsf")
Set lndbcontview = lndb.GetView("($VIMPeople)")
'Set jndb = New NotesDatabase(db.server, contdoc.DBPath(0))
'Set jndbcontview = jndb.GetView("By Date")
Set jndbcontview = finddb.GetView("By Date")
Set date1 = New NotesDateTime(Now)
'Get Database from the Database Directory on the server
Forall x In contdoc.UserList
Set username = New NotesName(x)
str1 = username.Abbreviated
Set dc = finddb.AllDocuments
For i = 1 To dc.count
Set firstdoc = dc.GetNthDocument(i)
Set lndbcontdoc = lndbcontview.GetDocumentByKey(str1, False)
If Not lndbcontdoc Is Nothing Then
str2 = lndbcontdoc.InternetAddress(0)
End If
'Set jndbcontdoc = jndbcontview.GetDocumentByKey(str1, True)
If Not firstdoc Is Nothing Then
If firstdoc.From(0) = str1 Or firstdoc.CopyTo(0) = str1 Or firstdoc.BlindCopyTo(0) = str1 Or firstdoc.SendTo(0) = str1 Or firstdoc.From(0) = str2 Or firstdoc.CopyTo(0) = str2 Or firstdoc.BlindCopyTo(0) = str2 Or firstdoc.SendTo(0) = str2 Or firstdoc.From(0) = username.canonical Or firstdoc.CopyTo(0) = username.canonical Or firstdoc.BlindCopyTo(0) = username.canonical Or firstdoc.SentTo(0) = username.canonical Then
Call firstdoc.CopyToDatabase(db)
End If
End If
Next i
End Forall
End If
End If
End If
End If
Set finddb = dbdir.GetNextDatabase
Wend
End Sub
Thanks in advance,
ac ac