NotesDbDirectory and Error (4197): Must call GetFirstDbFile before GetNextDbFile

I have a scheduled agent that uses the NotesDbDirectory class. It cycles through a list of servers, then through each database on the server.

Here is my code snippet:

Dim dbDir As NotesDbDirectory

Forall servers In serverList

	serverName = servers

	Set dbDir = New NotesDbDirectory(serverName)		

	'Let's start to run through all DBs on the Server...

	Set dbCheck = dbDir.GetFirstDatabase(DATABASE)

	While Not(dbCheck Is Nothing)

Set dbCheck = dbDir.GetNextDatabase

	Wend

End Forall

I am receiving this error, Error (4197): Must call GetFirstDbFile before GetNextDbFile, in the server log, when it hits:

Set dbCheck = dbDir.GetNextDatabase

I found this post, but it did not help:

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/91f342f32918d1a385256b750076e544?OpenDocument

It seems that the ID that signed the agent does not have access to the server, so it is throwing this error.

Should I trap this error and perform a Resume Next? Or do I have to reset the NotesDbDirectory object?

Thanks!

Dan

Subject: NotesDbDirectory and Error (4197): Must call GetFirstDbFile before GetNextDbFile

t

Subject: RE: NotesDbDirectory and Error (4197): Must call GetFirstDbFile before GetNextDbFile

Paul,

Just wondered if this was a mistake. All I see is “t”…

Thanks!

Dan