Subject: Use ArchLastRunDestDBs field in ArchiveProfile
This should contain the correct information.
For server based archiving it will be somtheing like CN=Server/OU=orgunit/O=Organisation!!Archive\a_yourmail.nsf
However when a user has never accessed his/her archive/archive settings there will not be an archiveprofile and the archiving process will not create one.
This is a button script to read all the user mailfiles and tell you the filename and the archive path/filename. You can modify it to do what you need. you would put this script under a button in an email or a rich text field in a document. This assumes you have manager access to all the mailfiles.
Sub Click(Source As Button)
On Error Resume Next
'this script asks you what server, then lists all the databases on that server
Dim session As New NotesSession
Dim db As notesdatabase
Dim db1 As NotesDatabase 'poll thru databases
Dim counter As Integer
Dim myserver As Variant
Dim uidoc As NotesUIDocument
Dim NewList As String
Dim result As Variant
Set ws = New NotesUIWorkspace
Set uidoc=ws.CurrentDocument
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim createDate As Variant
myserver = Split(Inputbox$("List servers separated by commas and no spaces."), ",")
NewList = ""
Forall srvr In myserver
Dim dbdir As New notesdbdirectory(srvr)
Set db1 = dbdir.getfirstdatabase(DATABASE)
While Not(db1 Is Nothing)
If Left(db1.FilePath,5) = "mail\" Then 'only if it is in mail directory 'IT IS A MAILFILE
dbname = db1.Filepath
Set db=session.GetDatabase(srvr,dbname)
Set arcdoc=db.GetProfileDocument("Archive Profile")
arcfile = arcdoc.ArchivePath(0)
newlist = db.title + " : " + arcfile
Call uidoc.FieldAppendText("Body",newlist+ Chr$(10))
End If 'IT IS A MAILFILE
Set db1 = dbdir.getnextdatabase
Wend
End Forall
Call uidoc.refresh
Messagebox("done")
Create an empty database and add a form called “Log” with the following fields
Name
MailServer
MailFile
dbList
Create a view to display the docs created with this form. Add a scheduled agent with the below code …
Sub Initialize
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim nab As NotesDatabase
Set db = ns.CurrentDatabase
Set nab = ns.GetDatabase(db.Server, "names.nsf")
Dim ndb As NotesDatabase
Dim ndc As NotesDocumentCollection
Dim doc As NotesDocument
Dim note As NotesDocument
' get mail file collection
Dim pdocs As NotesDocumentCollection
Dim pdoc As NotesDocument
Dim archdblist ( ) As String
sf$ = | SELECT Type = "Person" & MailServer != "" & !@IsAvailable($Conflict) |
Set pdocs = nab.Search(sf$, Nothing, 0)
If pdocs.Count > 1 Then
Set pdoc = pdocs.GetFirstDocument
While Not pdoc Is Nothing
Print "processing: " & pdoc.LastName(0) & ", " & pdoc.FirstName(0)
serv$ = pdoc.MailServer(0)
file$ = pdoc.MailFile(0)
Set ndb = ns.GetDatabase( serv$, file$ )
If Not ndb.IsOpen Then
Goto nxtdb
End If
Set ndc = ndb.GetProfileDocCollection( "archive profile" )
Set doc = ndc.GetFirstDocument
While Not doc Is Nothing
If doc.HasItem("ArchLastRunDestDbs") Then
If doc.ArchLastRunDestDbs(0) <> "" Then
count% = 0
Forall n In doc.ArchLastRunDestDBs
count% = count% + 1
End Forall
Redim archdblist ( 1 To count% ) As String
Forall a In doc.ArchLastRunDestDBs
archdblist(count%) = a
count% = count% - 1
End Forall
Set note = db.CreateDocument
With note
.Form = "Log"
.Name = pdoc.FullName(0)
.MailServer = serv$
.MailFile = file$
.dbList = archdblist
End With
Call note.Save(True, False)
End If
End If
Set doc = ndc.GetNextDocument(doc)
Wend
nxtdb:
Set pdoc = pdocs.GetNextDocument(pdoc)
Wend
End If