Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Suggested answer

WinSCP problem in nav

Posted on by Microsoft Employee

Hey guys . When trying to upload/donwload from FTp test server to nav  and using WinSCP i get an error of type ,cant load WinSCP instances.Any suggestions ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: WinSCP problem in nav

    Hey there can I have the text or fob file as well please. Thank you, Geovanny

  • Rashed Profile Picture
    Rashed 3,765 on at
    RE: WinSCP problem in nav

    Hello

    Make sure you have the right version.  Or re-select the variables in your designer.  WinSCP releases updates so the version installed on your computer will be different than the one running on your client.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: WinSCP problem in nav

    Ok , but how can i ask you about some things i dont understand there , if possible ?!

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,640 on at
    RE: WinSCP problem in nav

    Sorry, I don't have the fob, I have the text file if you need it.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: WinSCP problem in nav

    Hey Suresh , can i have the fob of your previuous example ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: WinSCP problem in nav

    Yes but it was given the way they need it to be done ,thats why i need to use WinSCP. I am sharing you the code but i dont think teres problem in the code because wheni try to save codeunit it says canot load WinSCP....... the specific .Net variable.

    Heres the code :

    LEAR(WinSCPSessionOptions);

    CLEAR(WinSCPSesh);

    CLEAR(TransferOptions);

    WinSCPSessionOptions := WinSCPSessionOptions.SessionOptions;

    WinSCPSessionOptions.HostName := 'INDIRIZZO IP';      

    WinSCPSessionOptions.UserName := 'USERNAME';          

    WinSCPSessionOptions.Password := 'PASSWORD';          

    WinSCPSessionOptions.PortNumber :=21;                

    DirectorySFTP := '/DIRECTORYFTP/';                      

    Protocol := Protocol.Ftp;

    WinSCPSessionOptions.Protocol(Protocol);

    FtpSecure := FtpSecure.Explicit;

    WinSCPSessionOptions.FtpSecure(FtpSecure);

    WinSCPSessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate(TRUE); // acquisisce e valida in automatico l'impronta digitale (certificato) del server

    WinSCPSesh := WinSCPSesh.Session;

    WinSCPSesh.Open(WinSCPSessionOptions);

    IF WinSCPSesh.Opened THEN BEGIN

     TransferOptions := TransferOptions.TransferOptions;

     TransferOptions.TransferMode := TrasferMode.Binary;

     TransferOperationResult := WinSCPSesh.PutFiles('FILE DA INVIARE',DirectorySFTP,FALSE,TransferOptions);  

     IF TransferOperationResult.IsSuccess THEN

         MESSAGE('Upload completato')

     ELSE BEGIN

       SessionRemoteExceptionCollection := TransferOperationResult.Failures;

       FOREACH SessionRemoteException IN SessionRemoteExceptionCollection DO

         MESSAGE(SessionRemoteException.ToString);

     END;

    END ELSE

     MESSAGE(GETLASTERRORTEXT);

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,640 on at
    RE: WinSCP problem in nav

    Share your code. You don't need to use the WinSCP to upload/download you can connect directly to the server without additional software. I believe I have already shared code with you in other thread.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans