HI,
I have a scheduled agent that run every subday. this agent establishes a ftp session and get connected to the ftp server, takes a file from the ftp server and saves it to the domino server directory.
Below is the code:
Set objFTP=New NotesFTPSession 'Creating new FTP session
With objFTP
.Connect IPAddress, Username, Password, 0
'Authenticating UserName and Password
.ChangeDirectory FTPFolderName
'Redirecting to the desired folder
'Download Weekly File
.Getfile FTPWeeklyFileName + Cstr(Format(DateTime.Dateonly,“yymmdd”)) + “.txt”, DominoServerFolder+ DownloadedWeeklyFileName+ Cstr(Format(DateTime.Dateonly,“yymmdd”))+ “.xls”, FTP_TRANSFER_TYPE_ASCII ’ Get file from FTP site
.Disconnect
Disconnect from the server
End With
Delete objFTP
'End the FTP connection session
The above methods are defined in a script library that use the wininet.dll.
The code works uptill the connection and the directory change but fails at the GetFile method of the dll file and throw an error.
Can someone please help on this? Any help will be greatly appreciated.
Regards,
Manav
Subject: FTP Transfer using the wininet.dll functions
Error messages?Debug outputs?
Have you checked the issue at MS user forums (I’m guessing this uses Win API functions).
Have you verified you’re passing in a valid file name?
Subject: RE: FTP Transfer using the wininet.dll functions
Hey Doug,
Thanks for your response.
Yeah I am passing the correct file name to the agent that is stored in a profile document.
The error that I receive is “Cannot download file from host”.
I am using the ScriptLibrary for ftp in the sandbox.
Regards
Subject: works for me
I just downloaded the db and set up a quick test with the following code:
Sub Click(Source As Button)
Dim objFTP As NotesFTPSession
Set objFTP=New NotesFTPSession
With objFTP
.Connect "ftp.myserver.com", "username", "password", 0
.ChangeDirectory "BILLS OF MATERIALS"
.GetFile "PartNumberFile.xls", "c:\MyFTP.XLS", FTP_TRANSFER_TYPE_ASCII
.Disconnect
End With
Delete objFTP
End Sub
If I spelled the ‘change directory’ wrong, I got an: ‘could not set current directory on host’ error
If I spelled the file name wrong, I got an: "could not download file from host’ error.
HTH
Doug
Subject: RE: works for me
DOug,
I am giving the correct file name but its giving me the same error.
So you got it run successfully?
Well i need help as to what is going wrong here, I have also posted it to the author in the sandbox.
Waiting for help on this.
Subject: RE: works for me
I’d check the file name and path very carefully. I can get the same error you’re seeing, but only if the file name I give the script is not the same as the file on the server.
Best of luck.
Subject: RE: FTP Transfer using the wininet.dll functions
Haven’t tried that library so I can’t provide much specific help. You might want to see if the library author can help. Either way, if you’re using a MS dll, you may still want to go visit some of the MS forums and see what help they can provide.
Can you download the file via a full-up ftp client? Any chance it’s a rights thing?
Doug