Objective: Retrieve first dB in mail Folder archive mail file then loop through all remainig Db’s.
Cannot retrieve mail folder on server, but it does exist…
Am I using session.GetDbDirectory correctly?
my test code :-
Sub Initialize
Dim directory As NotesDbDirectory
Dim session As New NotesSession
Dim db As NotesDatabase
Dim replica As NotesDatabase
Set directory = session.GetDbDirectory("App01/mail")
Set db = directory.GetFirstDatabase(DATABASE)
Msgbox db.FileName
End Sub
Thanks in advance
Subject: session.GetDbDirectory?
Is App01/mail the name of your server? or is that representing the mail directory on the app01 server?
I think it should be
set directory = session.getDbDirectory(“App01”)
Set db …
then, just loop through the db’s - I think it will return all databases on the server. just check each db’s path. If it’s in the correct folder then process it, otherwise, just skip to the next.
HTH
kiers
Subject: session.GetDbDirectory?
GetDbDirectory is IMHO a bit of a misnomer, as it doesn’t get a specific directory but a handle on an object that allows you to navigate the databases / folders on a specific server.
Assuming your server is App01 then your code should probably be:
…
Set directory = session.GetDbDirectory(“App01”)
Set db = directory.GetFirstDatabase(DATABASE)
while instr(db.filepath,“mail”)<>1
Set db = directory.GetNextDatabase
wend
Msgbox db.FileName
End Sub
Also I have a vague feeling that the “first” database may not necessarily be the first alphabetically!
HTH - Rufus.
Subject: session.GetDbDirectory now works. Thanks.
Sub Initialize Dim directory As New NotesDbDirectory(“App01”)
Dim session As New NotesSession
Dim db As NotesDatabase
Set directory = session.GetDbDirectory("App01")
Set db = directory.GetFirstDatabase(DATABASE)
While Instr(db.filepath,"mail")<>1
Set db = directory.GetNextDatabase
Wend
Msgbox db.FileName
End Sub
Subject: RE: session.GetDbDirectory now works. Thanks.
Spooky - that code looks strangely familiar.
Glad it works though!
Rufus.