LOtusscript Scheduled Agent access to calendar fails to get entries on

When running lotusscript Agent manually on domino 9.01 all works but scheduled and run on server with same user and level 3 permissions
I have access to the maildb but the getentries does not return any

Call reg.GetUserInfo(uname, mailserver$, mailfile$, maildomain$, mailsystem%, profile$)
			Set maildb = session.getdatabase(mailserver$,mailfile$)
			If Not maildb Is Nothing then
			Call agentlog.LogAction("mailserver:" + mailserver$ + "mailfile:" + mailfile$ + "maildb is ok")
				Call agentlog.LogAction("mailserver:" + mailserver$ + "mailfile:" + mailfile$ + "maildb not ok")
			End if
			Set cal = Nothing
		        Set caldoc = Nothing
		        Set caledoc = Nothing
		        sunid = ""
		        Set cal = session.getCalendar(maildb)
		        If Not cal Is Nothing Then
		           Call agentlog.LogAction("got cal")
			  Call agentlog.LogAction("cal failed")
		      End If
		      Dim ent As Variant
		      ent = cal.Getentries(dt1,dt2)
		      If ent Is Nothing Then
			 Call agentlog.LogAction("ent is nothing")	
	 	      End If
		     ForAll calent In cal.Getentries(dt1, dt2)
				Set caledoc = calent.Getasdocument()
				If Not caledoc Is Nothing Then
					Call agentlog.LogAction("caledoc is ok" + caledoc.Universalid)

Open in new window

Who is Participating?
NeilJohnEvansAuthor Commented:
Thanks for the reply Sjef, I have found my issue I should have put an isOpen on the database as it ended up being permissions, It was odd that it would work in the foreground using my current permissions but when scheduled ( using myself again) it actually failed to open the database. I only discovered this by using CSDebugAPI = 1 in the notes.ini
so your comment about log messages sent me in the right direction.
Sjef BosmanGroupware ConsultantCommented:
GetEntries doesn't seem to return Nothing, only an empty array, so line 21 will fail. You could try IsEmpty().
But that obviously isn't the thing that's bugging you here, given the fact that it does run in Notes, in the foreground. Some silly questions: is the server R9+ as well, is the C&S API installed on the server, do you get any messages in the log?

PS I've yet to use the C&S API... It's completely new to me :$
Sjef BosmanGroupware ConsultantCommented:
Nice! :-)
NeilJohnEvansAuthor Commented:
I ended up fixing the issue myself
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.