Pb with scheduled agent to export view

Hello

I’ve written a lotusscript agent that exports a view to a csv file

The csv file is created on another server

The agent works just fine when I run it manually but won’t do anything when scheduled.

I get the following error

“ERROR 101: Unable to open file on line 21”

I think it’s a matter of security but I’m at my wit’s end there and could use some help.

What should I do to ensure my agent will work ? Or is it just not possible to modify a file on another server like I’m trying to do ?

Also, I add that I signed the agent with the server’s ID

Here’s the code in case it is of any help :

On Error Goto errorHandle

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument

Dim fn As Integer 

Dim filepath As String

Dim profiledoc As NotesDocument



Set db = session.CurrentDatabase

Set view = db.GetView("viewExport")

Set doc = view.GetFirstDocument

If doc Is Nothing Then Exit Sub

Set profiledoc = db.GetProfileDocument("Config")

filepath = profiledoc.csvfolder(0)

filepath = filepath + "fax.csv"

fn = Freefile( ) 	' create the csv file

Open filepath For Output As fn

While Not doc Is Nothing

	Print #fn, doc.FullName(0) & ", " & doc.FAX(0)

	Set doc = view.GetNextDocument(doc)

Wend

Close fn 

Exit Sub

errorHandle:

Msgbox "ERROR " & Str(Err) & ": " & Error$ & " on line " & Cstr(Erl)

Exit Sub