Why my codes get different result from manually run and scheduled run?

HI,I include these codes in my agent to deal with attachment and re-save document. but it works when run it manually. it does not work when run it scheduelly, the document can not be saved from backend.

I think the schedule agent can not recognize the c drive, but manually run can.

Does anybody have any idea to let schedule agent to recognize the local c drive? Thanks a lot,

Forall f In docA.Items

	Select Case f.Type 

	Case 1084

		Set obj=docA.GetAttachment(f.values(0))	

		If Not obj Is Nothing Then

			If newcorpdoc.GetAttachment(f.values(0)) Is Nothing Then			

				Call obj.ExtractFile("c:\"+f.values(0))

				Call rtitem.AddNewLine(1,False )

				Set object= rtitem.EmbedObject( EMBED_ATTACHMENT, "", "c:\"+f.values(0))

				Kill "c:\"+f.values(0)

				Call obj.Remove

			End If

		End If

	End Select

End Forall

Subject: Why my codes get different result from manually run and scheduled run?

Is the agent signed by an ID (you) who has unrestricted access? You will likely need unrestricted access to write to the C drive.

I sure you know, as it’s running on a server, it will be writing to the servers C drive and not your local drive (hence why the unrestricted requirement).

If you eventually want to write to a network drive, don’t forget you will also need to consider network security also.

Subject: RE: Why my codes get different result from manually run and scheduled run?

Thanks for the help,I think you are talking about the following options on Security tab of agent , I am choosing the first one. is that right?

The agent was assigned a special id in production, not my id.

But it runs my id in development environment. I think my id should be able to access c in devs server.

Any more concerns to solve the problem? Thanks a lot,

  1. Do not allow restricted operations,

2.Allow restricted operations

3.Allow restricted operations with full administration right

Subject: RE: Why my codes get different result from manually run and scheduled run?

The ID that is running the agent needs to have “Unrestricted” access on the server. Those who have the access is set in the server document:

Open your corporate address book (not your personal) or your test environments.

On the left navigator choose > Configuration > Servers > All Server Documents

Locate and open the document for the server you’re running the scheduled agent.

Click on the security tab and on the top of the right column you should see who can run unrestricted methods and operations.

When you write to the C drive from the server this requires unrestricted access. To learn more go to help in designer and look-up unrestricted and open the document Restricted LotusScript and Java agent operations.

EmbededObject() is listed.

Subject: RE: Why my codes get different result from manually run and scheduled run?

what error is returned when run on schedule?

Subject: RE: Why my codes get different result from manually run and scheduled run?

Problem solved with "Allow restricted operations with full administration right options on the security of scheduled agent. Thanks for any help,

Subject: RE: Why my codes get different result from manually run and scheduled run?

Hi,

I think it is enough if you select the “Allow restricted operations” for agent. You need this setting to write to a file - as I remember.

Attila