LinnSystems / LinnworksNetSDK

Linnworks.net Developers
26 stars 41 forks source link

Macro Dropbox Upload Not explained #23

Closed MSITApps closed 5 years ago

MSITApps commented 5 years ago

Hello,

I am trying to upload a file on dropbox but the external code of Dropbox and their DLL does not support Linnworks.net Macro and I could not find any reference or information in this wiki SDK documentation.

I have seen a few pre-defined functioned developed in this SDK for FTP, SFTP, and Dropbox. I have managed to list all directly using this FTP function but I want to upload the file on Dropbox and I don't know how.

Also, I thought of alternate solution by using file upload on FTP but it's not explained as well.

I have seen and tried below function: ProxyFactory.GetDropboxUploadProxy(DropboxSettings)

But I get "Null reference error". Also, I don't find any info on how to write a stream on the above function.

Please help if anyone had tried this. Thanks in advance.

Regards,

LinnSystems commented 5 years ago

Hi,

With macro functionality currently in beta, documentation is still a work-in-progress. You're on the right track, though, with GetDropboxUploadProxy. You can call this like below:

var proxy = ProxyFactory.GetDropboxUploadProxy(new LinnworksMacroHelpers.Classes.DropboxSettings
{
    FullPath = "{{FULL-PATH-TO-FILE-ON-DROPBOX}}",
    Token = "{{DROPBOX-API-TOKEN}}"
});

proxy.Write("{{STRING-VALUE-TO-UPLOAD}}");

var result = proxy.CompleteUpload();

if (!result.IsSuccess)
    throw new Exception(result.ErrorMessage);