I am using an agent that opens a .TXT file located on the c:\ of a users machine and creates documents from it.
It runs great when I run it from Designer or my client but when I run it from the web in a WebQuerySave event, I get an ‘Unable to Open File’ message in the log.
The agent is set to run as web user and as a #2 Allow Restricted Operations. I have also tried it as a #3 but that didn’t work either.
HELP (please!)!
Here is the gist of the code:
Messagebox "Msg 1 "
filePath$="c:\"
fileName$= "newitems.txt"
fileNum% = Freefile()
Messagebox "Msg 2"
delimiter = " " ' Delimiter of your file
cells = 5 ' How many cells + 1
k = 0
Open "C:\newitems.txt" For Input As fileNum%
Messagebox "Msg 3"
Do While Not Eof(fileNum%)
Line Input #1, InputStr$
FieldArray = parseall(InputStr$, delimiter, cells)
response% = CreateDocument(FieldArray)
k = k + 1
Messagebox "Document Created: " + Cstr(k)
Loop
Subject: Agent error ‘Unable to open file’
The WQS agent runs on the server.
Is there a file called newitems.txt on the server? Is there even a C: drive?
Subject: RE: Agent error ‘Unable to open file’
It is not on the server, I want the user to put the file on their c:\ drive on their local machine/workstation
Subject: RE: Agent error ‘Unable to open file’
Well, no. It IS on the server. Because all kinds of Web agents ever and always run on the server and thus never have access to the user’s workstation.
To upload a file, you must include a File Upload Control element in your form (Create → Embedded Element → File Upload Control).
Subject: RE: Agent error ‘Unable to open file’
Hello,
I’m having the same problem and all the threads in this forum have people posting it as well. However, nobody who originally posted is providing a solution. I’m not sure if there is one?
Let me know if you got this working. I have a scheduled agent that needs to read a text file located in “data\vantive”.
Subject: RE: Agent error ‘Unable to open file’
You seem to suspect a general pattern, where there is none.
Agents that run on a server have no general problem to access data inside a folder on the server’s hard drive, if permissions are set correctly.
Accessing files on a network share is often more of a problem (especially on Windows), if the server runs as an OS service, because the local System account (generally used to run the Domino server) does not have access to network drives like users have.
Server side agents can never access files on user’s workstations (for the obvious reasons).
If you want an answer specific to your situation, you have to post your specific code and environmental conditions.
P.S.
If you look a little closer, you will find out that Julia (like many others) was able to solve her problem.
Subject: Agent error ‘Unable to open file’
The WebQuerySave event is run on the server and NOT locally as the agent does when You run it manually, therefore the file must be located on the server in the path c:\newitems.txt". I suspect the file doesn’t exists on the server and hence the error message.
You can NOT use WebQuerySave event if You need to save/read files on the USERS local machine.
hth
Subject: RE: Agent error ‘Unable to open file’
Thanks for all of the responses. I have added the File Upload Control and have the file detaching on my domino server successfully. Now I just need to tweak the code that was opening the file and creating documents.
Thanks so much!