Hello,
 
I search to store all the files contained in the repertory which I 
selected. If you had an Idea or example's code, It would be very 
great 

Cordially Sebastien Manjony 


--- In [email protected], "Mayle, Michael" 
<[EMAIL PROTECTED]> wrote:
>
> Here is a copy of the XPO of all of Jan's wonderful tips here. I 
have also added my own ftpCreateDirectory, ftpDeleteFile, 
ftpRemoveDirectory, and ftpRenameFile, and I as well as have 
attempted ftpCommand and ftpGetCurrentDirectory, but gave up. Please 
share any solutions that you may have added to the class (FTP-wise). 
I am especially interested in getting the ftpCommand to work (no luck 
so far.)
> 
> Enjoy!
> --Mike
> 
> Exportfile for AOT version 1.0 or later
> Formatversion: 1
> 
> ***Element: CLS
> 
> ; Axapta Class: WinInet unloaded at Monday 1/9/2006
> ; ------------------------------------------------------------------
--------------
>   CLSVERSION 1
>   
>   CLASS #WinInet
>     PROPERTIES
>       Name                #WinInet
>       Extends             #
>       RunOn               #Client
>     ENDPROPERTIES
>     
>     METHODS
>       Version: 3
>       SOURCE #classDeclaration
>         #final class WinInet
>         #{
>         #    DLL _winInet;
>         #    DLLFunction _internetOpen;
>         #    DLLFunction _internetCloseHandle;
>         #    DLLFunction _internetOpenUrl;
>         #    DLLFunction _internetReadFile;
>         #
>         #    int _handle;
>         #    int _result;
>         #
>         #    DLLFunction _internetConnect;
>         #    DLLFunction _ftpGetFile;
>         #    DLLFunction _ftpPutFile;
>         #    DLLFunction _ftpSetCurrentDirectory;
>         #    DLLFunction _ftpCommand;
>         #    DLLFunction _ftpFindFirstFile;
>         #    DLLFunction _ftpDeleteFile;
>         #    DLLFunction _ftpRenameFile;
>         #    DLLFunction _ftpCreateDirectory;
>         #    DLLFunction _ftpRemoveDirectory;
>         #    DLLFunction _ftpGetCurrentDirectory;
>         #
>         #
>         #    #define.FTP_TRANSFER_TYPE_BINARY(2)
>         #    #define.FTP_TRANSFER_TYPE_UNKNOWN(0)
>         #    #define.FTP_TRANSFER_TYPE_ASCII(1)
>         #
>         #}
>       ENDSOURCE
>       SOURCE #finalize
>         #void finalize()
>         #{
>         #    this.internetCloseHandle(_handle);
>         #}
>       ENDSOURCE
>       SOURCE #ftpCommand
>         #int ftpCommand(int _handler, boolean _expectResponseIn, 
str 255 _command)
>         #{
>         #    int _handlerOut;
>         #    int _expectResponse;
>         #    ;
>         #
>         #    if (_expectResponseIn)
>         #        _expectResponse = 1;
>         #    else
>         #        _expectResponse = 0;
>         #
>         #    if(_ftpCommand.call(_handler, _expectResponse, 
#FTP_TRANSFER_TYPE_ASCII, _command, 0, _handlerOut) == 0)
>         #        return 0;
>         #    else
>         #        return _handlerOut;
>         #}
>       ENDSOURCE
>       SOURCE #ftpCreateDirectory
>         #boolean ftpCreateDirectory(int _hdl, str 255 _name)
>         #{
>         #    if (_ftpCreateDirectory.call(_hdl, _name) == 0)
>         #        return false;
>         #    else
>         #        return true;
>         #}
>       ENDSOURCE
>       SOURCE #ftpDeleteFile
>         #boolean ftpDeleteFile(int _hdl, str 255 _file)
>         #{
>         #    if (_ftpDeleteFile.call(_hdl, _file) == 0)
>         #        return false;
>         #    else
>         #        return true;
>         #}
>       ENDSOURCE
>       SOURCE #ftpGetCurrentDirectory
>         #int ftpGetCurrentDirectory(int _hdl, str 255 _remoteFile, 
str 255 _localFile)
>         #{
>         #    return 0;//_ftpGetCurrentDirectory.call
(_hdl,_remoteFile,_localFile,false,0,#FTP_TRANSFER_TYPE_BINARY,0);
>         #}
>         #
>       ENDSOURCE
>       SOURCE #FtpGetFile
>         #int ftpGetFile(int _hdl, str 255 _remoteFile, str 255 
_localFile)
>         #{
>         #    return _FtpGetFile.call
(_hdl,_remoteFile,_localFile,false,0,#FTP_TRANSFER_TYPE_BINARY,0);
>         #}
>       ENDSOURCE
>       SOURCE #FtpPutFile
>         #int ftpPutFile(int _hdl, str 255 _localFile, str 255 
_remoteFile)
>         #{
>         #    return _FtpPutFile.call
(_hdl,_localFile,_remoteFile,#FTP_TRANSFER_TYPE_BINARY,0);
>         #}
>       ENDSOURCE
>       SOURCE #ftpRemoveDirectory
>         #boolean ftpRemoveDirectory(int _hdl, str 255 _name)
>         #{
>         #    if (_ftpRemoveDirectory.call(_hdl, _name) == 0)
>         #        return false;
>         #    else
>         #        return true;
>         #}
>       ENDSOURCE
>       SOURCE #ftpRenameFile
>         #boolean ftpRenameFile(int _hdl, str 255 _fileOld, str 255 
_fileNew)
>         #{
>         #    if (_ftpRenameFile.call(_hdl, _fileOld, _fileNew) == 0)
>         #        return false;
>         #    else
>         #        return true;
>         #}
>       ENDSOURCE
>       SOURCE #ftpSetCurrentDirectory
>         #Boolean ftpSetCurrentDirectory(int _handler, str _name)
>         #{
>         #    ;
>         #
>         #    if (_handler == 0)
>         #        return false;
>         #
>         #    if (_ftpSetCurrentDirectory.call(_handler, _name) == 0)
>         #        return false;
>         #    else
>         #        return true;
>         #}
>         #
>       ENDSOURCE
>       SOURCE #internetCloseHandle
>         #boolean internetCloseHandle(int handle)
>         #{
>         #    return _internetCloseHandle.call(handle);
>         #}
>       ENDSOURCE
>       SOURCE #internetConnect
>         #int internetConnect(str 60 _server, str 99 _userName, str 
99 _password )
>         #{
>         #    return _internetConnect.call
(_handle,_server,0,_userName,_password,1,0,0);
>         #}
>       ENDSOURCE
>       SOURCE #internetOpen
>         #int internetOpen(str 255 agent,int accessType,str 255 
proxyName,str 255 proxyByPass,int flags)
>         #{
>         #
>         #
>         #
>         #    return _internetOpen.call
(agent,accessType,proxyName,proxyByPass,flags);
>         #}
>       ENDSOURCE
>       SOURCE #internetOpenUrl
>         #int internetOpenUrl(str 500 url,int flags = 0,int context 
= 0)
>         #{
>         #    Binary _headers = new Binary(512);
>         #    int hdl = _internetOpenUrl.call(_handle,url,"",-
1,flags,context);
>         #    return hdl;
>         #
>         #
>         #}
>       ENDSOURCE
>       SOURCE #internetReadFile
>         #str internetReadFile(int hdl)
>         #{
>         #    Binary _buffer = new Binary(2048);
>         #    Binary _bytesRead = new Binary(4);
>         #    str result;
>         #    boolean ret;
>         #    int done = 0;
>         #
>         #    while (! done)
>         #    {
>         #        ret = _internetReadFile.call
(hdl,_buffer,2000,_bytesRead);
>         #        if ((! _bytesRead.dWord(0)) || (! ret))
>         #            done = 1;
>         #        else
>         #        {
>         #            result += subStr(_buffer.string
(0),1,_bytesRead.dWord(0));
>         #        }
>         #    }
>         #    return ret ? result : "";
>         #}
>       ENDSOURCE
>       SOURCE #new
>         #void new()
>         #{
>         #    try
>         #    {
>         #        _winInet = new DLL("WinInet");
>         #    }
>         #    catch(Exception::Internal)
>         #    {
>         #        infolog.clear();
>         #        return;
>         #    }
>         #
>         #    _internetOpen = new DLLFunction
(_winInet,"InternetOpenA");
>         #    _internetOpen.returns(ExtTypes::DWORD);
>         #    _internetOpen.arg(ExtTypes::STRING);
>         #    _internetOpen.arg(ExtTypes::DWORD);
>         #    _internetOpen.arg(ExtTypes::STRING);
>         #    _internetOpen.arg(ExtTypes::STRING);
>         #    _internetOpen.arg(ExtTypes::DWORD);
>         #
>         #    _internetCloseHandle = new DLLFunction
(_winInet,"InternetCloseHandle");
>         #    _internetCloseHandle.returns(ExtTypes::DWORD);
>         #    _internetCloseHandle.arg(ExtTypes::DWORD);
>         #
>         #    _internetOpenUrl = new DLLFunction
(_winInet,"InternetOpenUrlA");
>         #    _internetOpenUrl.returns(ExtTypes::DWORD);
>         #    _internetOpenUrl.arg(ExtTypes::DWORD);
>         #    _internetOpenUrl.arg(ExtTypes::STRING);
>         #    _internetOpenUrl.arg(ExtTypes::STRING);
>         #    _internetOpenUrl.arg(ExtTypes::DWORD);
>         #    _internetOpenUrl.arg(ExtTypes::DWORD);
>         #    _internetOpenUrl.arg(ExtTypes::DWORD);
>         #
>         #    _internetReadFile = new DLLFunction
(_winInet,"InternetReadFile");
>         #    _internetReadFile.returns(ExtTypes::DWORD);
>         #    _internetReadFile.arg(ExtTypes::DWORD);
>         #    _internetReadFile.arg(ExtTypes::POINTER);
>         #    _internetReadFile.arg(ExtTypes::DWORD);
>         #    _internetReadFile.arg(ExtTypes::POINTER);
>         #
>         #    _handle = this.internetOpen("Axapta",0,"","",0);
>         #
>         #    _internetConnect = new DLLFunction
(_winInet,"InternetConnectA");
>         #    _internetConnect.returns(ExtTypes::DWORD);
>         #    _internetConnect.arg(ExtTypes::DWORD);
>         #    _internetConnect.arg(ExtTypes::STRING);
>         #    _internetConnect.arg(ExtTypes::DWORD);
>         #    _internetConnect.arg(ExtTypes::STRING);
>         #    _internetConnect.arg(ExtTypes::STRING);
>         #    _internetConnect.arg(ExtTypes::DWORD);
>         #    _internetConnect.arg(ExtTypes::DWORD);
>         #    _internetConnect.arg(ExtTypes::DWORD);
>         #
>         #    _ftpGetFile  = new DLLFunction(_winInet,"FtpGetFileA");
>         #    _ftpGetFile.returns(ExtTypes::DWORD);
>         #    _ftpGetFile.arg(ExtTypes::DWORD);
>         #    _ftpGetFile.arg(ExtTypes::STRING);
>         #    _ftpGetFile.arg(ExtTypes::STRING);
>         #    _ftpGetFile.arg(ExtTypes::DWORD);
>         #    _ftpGetFile.arg(ExtTypes::DWORD);
>         #    _ftpGetFile.arg(ExtTypes::DWORD);
>         #    _ftpGetFile.arg(ExtTypes::DWORD);
>         #
>         #    _ftpPutFile  = new DLLFunction(_winInet,"FtpPutFileA");
>         #    _ftpPutFile.returns(ExtTypes::DWORD);
>         #    _ftpPutFile.arg(ExtTypes::DWORD);
>         #    _ftpPutFile.arg(ExtTypes::STRING);
>         #    _ftpPutFile.arg(ExtTypes::STRING);
>         #    _ftpPutFile.arg(ExtTypes::DWORD);
>         #    _ftpPutFile.arg(ExtTypes::DWORD);
>         #
>         #    _ftpSetCurrentDirectory = new DLLFunction
(_winInet, 'FtpSetCurrentDirectoryA');
>         #    _ftpSetCurrentDirectory.returns(ExtTypes::DWORD);
>         #    _ftpSetCurrentDirectory.arg(ExtTypes::DWORD);
>         #    _ftpSetCurrentDirectory.arg(ExtTypes::STRING);
>         #
>         #    _ftpCommand = new DLLFunction(_winInet, 'FtpCommandA');
>         #    _ftpCommand.returns(ExtTypes::DWORD);
>         #    _ftpCommand.arg(ExtTypes::DWORD);
>         #    _ftpCommand.arg(ExtTypes::DWORD);
>         #    _ftpCommand.arg(ExtTypes::DWORD);
>         #    _ftpCommand.arg(ExtTypes::STRING);
>         #    _ftpCommand.arg(ExtTypes::DWORD);
>         #    _ftpCommand.arg(ExtTypes::DWORD);
>         #
>         #    _ftpDeleteFile = new DLLFunction
(_winInet, 'FtpDeleteFileA');
>         #    _ftpDeleteFile.returns(ExtTypes::DWORD);
>         #    _ftpDeleteFile.arg(ExtTypes::DWORD);
>         #    _ftpDeleteFile.arg(ExtTypes::STRING);
>         #
>         #    _ftpRenameFile = new DLLFunction
(_winInet, 'FtpRenameFileA');
>         #    _ftpRenameFile.returns(ExtTypes::DWORD);
>         #    _ftpRenameFile.arg(ExtTypes::DWORD);
>         #    _ftpRenameFile.arg(ExtTypes::STRING);
>         #    _ftpRenameFile.arg(ExtTypes::STRING);
>         #
>         #    _ftpCreateDirectory = new DLLFunction
(_winInet, 'FtpCreateDirectoryA');
>         #    _ftpCreateDirectory.returns(ExtTypes::DWORD);
>         #    _ftpCreateDirectory.arg(ExtTypes::DWORD);
>         #    _ftpCreateDirectory.arg(ExtTypes::STRING);
>         #
>         #    _ftpRemoveDirectory = new DLLFunction
(_winInet, 'FtpRemoveDirectoryA');
>         #    _ftpRemoveDirectory.returns(ExtTypes::DWORD);
>         #    _ftpRemoveDirectory.arg(ExtTypes::DWORD);
>         #    _ftpRemoveDirectory.arg(ExtTypes::STRING);
>         #
>         #    _ftpGetCurrentDirectory = new DLLFunction
(_winInet, 'FtpGetCurrentDirectoryA');
>         #    _ftpGetCurrentDirectory.returns(ExtTypes::DWORD);
>         #    _ftpGetCurrentDirectory.arg(ExtTypes::DWORD);
>         #    _ftpGetCurrentDirectory.arg(ExtTypes::STRING);
>         #    _ftpGetCurrentDirectory.arg(ExtTypes::STRING);
>         #
>         #    /*_ftpFindFirstFile = new DLLFunction
(_winInet, 'FtpFindFirstFileA');
>         #    _ftpFindFirstFile.returns(ExtTypes::DWORD);
>         #    _ftpFindFirstFile.arg(ExtTypes::DWORD);
>         #    _ftpFindFirstFile.arg(ExtTypes::STRING);*/
>         #
>         #}
>       ENDSOURCE
>       SOURCE #ok
>         #boolean ok()
>         #{
>         #    if (_winInet)
>         #        return TRUE;
>         #    else
>         #        return FALSE;
>         #}
>       ENDSOURCE
>     ENDMETHODS
>   ENDCLASS
> 
> ***Element: END
> 
> 
> 
> -----Original Message-----
> From: [email protected] [mailto:development-
[EMAIL PROTECTED] On Behalf Of Dahlsgaard Jan
> Sent: Friday, January 06, 2006 2:52 AM
> To: [email protected]
> Subject: SV: [development-axapta] Re: How to send file to FTP
> 
> This should do the trick:
>  
> Boolean ftpSetCurrentDirectory(str _name)
> {
>     DLLFunction setCurrentDirectory = new DLLFunction
(winInetDLL, 'FtpSetCurrentDirectoryA');
>     ;
>  
>     if (connectHandle == 0)
>         return false;
>  
>     setCurrentDirectory.returns(ExtTypes::DWord);
>  
>     setCurrentDirectory.arg(ExtTypes::DWord,
>                             ExtTypes::String);
>  
>     if (setCurrentDirectory.call(connectHandle, _name) == 0)
>         return false;
>     else
>         return true;
> }
>  
> Regards
> Jan Stelsig Dahlsgaard
> Fujitsu DK
> 
> ________________________________
> 
> Fra: [email protected] [mailto:development-
[EMAIL PROTECTED] På vegne af neih2lille
> Sendt: 5. januar 2006 18:35
> Til: [email protected]
> Emne: [development-axapta] Re: How to send file to FTP
> 
> 
> hi,
> your code is OK, but how can I change directory on FTP server?
> code example will appreciate.
> 
> regards,
> thanks
> 
> yannick
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> SPONSORED LINKS 
> Computer part <http://groups.yahoo.com/gads?
t=ms&k=Computer+part&w1=Computer+part&w2=Programming+languages&w3=Micr
osoft+axapta&w4=Support+exchange&c=4&s=90&.sig=yLpvcLTIDJ5FTkRJGsO11w>
        Programming languages <http://groups.yahoo.com/gads?
t=ms&k=Programming+languages&w1=Computer+part&w2=Programming+languages
&w3=Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=cuhEClK4dU4wapX
FmKisbQ>        Microsoft axapta <http://groups.yahoo.com/gads?
t=ms&k=Microsoft+axapta&w1=Computer+part&w2=Programming+languages&w3=M
icrosoft+axapta&w4=Support+exchange&c=4&s=90&.sig=yfeG_U6QaLfPOZZIud02
Fg>     
> Support exchange <http://groups.yahoo.com/gads?
t=ms&k=Support+exchange&w1=Computer+part&w2=Programming+languages&w3=M
icrosoft+axapta&w4=Support+exchange&c=4&s=90&.sig=hy8yRGMzrmxdphyITTUe
qA>     
> 
> ________________________________
> 
> YAHOO! GROUPS LINKS 
> 
> 
>       
> *      Visit your group "development-axapta 
<http://groups.yahoo.com/group/development-axapta> " on the web.
>         
> *      To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]
subject=Unsubscribe> 
>         
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service <http://docs.yahoo.com/info/terms/> . 
> 
> 
> ________________________________
> 
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
>


Reply via email to