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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 :$
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
Nice! :-)
NeilJohnEvansAuthor Commented:
I ended up fixing the issue myself
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.