Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Dowload file from a folder ?

 Post Reply Post Reply
Author
Gabriel Cristea View Drop Down
New Member
New Member
Avatar

Joined: 04 Oct 2018
Posts: 12
Post Options Post Options   Quote Gabriel Cristea Quote  Post ReplyReply Direct Link To This Post Topic: Dowload file from a folder ?
    Posted: 21 Mar 2019 at 12:09pm
Hi,

How can i download a file localized in a folder (with no selection on Treeview) with TMSFMXCloudGDrive1 and TMSFMXCloudSkyDrive1 ?

For TMSFMXCloudDropBox1 and TMSFMXCloudYandexDisk1 i use this code and work ok,
 // DropBox - download from specific folder - work OK!
            if xCloud.ClassNameIs('TTMSFMXCloudDropBox') then
            begin
              xDrop := TDropBoxItem.Create(nil);
              xDrop.ItemType := ciFile;
              xDrop.Path := xFolder + '/' + xFileName;
              //
              xCloud.Download(xDrop, xTargetFile);
            end;



Thank you !
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2112
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 21 Mar 2019 at 12:40pm
Hi,

Please note that GDrive requires a DownloadURL and SkyDrive an ID instead of a Path to be able to download a file.
You should be able to use the Search function to retrieve the required information for files similar as with retrieving a specific folder.
Back to Top
Gabriel Cristea View Drop Down
New Member
New Member
Avatar

Joined: 04 Oct 2018
Posts: 12
Post Options Post Options   Quote Gabriel Cristea Quote  Post ReplyReply Direct Link To This Post Posted: 21 Mar 2019 at 1:54pm
Hi Bart,

Sorry again, but can you help me with my code please ?
None of then are work properly 

          // GDrive
            if xCloud.ClassNameIs('TTMSFMXCloudGDrive') then
            begin
              xGDrive := TGDriveItem.Create(nil);
                 if TMSFMXCloudGDrive1.SearchFile(xCloudFolder + '/' + xCloudFile, true) then
                xGDrive := TGDriveItem(TMSFMXCloudGDrive1.Drive.Items[0]);
              //
              TMSFMXCloudGDrive1.Download(xGDrive,  xTargetFile);
            end;

            // SkyDrive
            if xCloud.ClassNameIs('TTMSFMXCloudSkyDrive') then
            begin
              // FOLDER
              xSkyFolder := TSkyDriveItem.Create(nil);
              TMSFMXCloudSkyDrive1.SearchList(xCloudFolder, true, nil);
              xSkyFolder := TSkyDriveItem(TMSFMXCloudSkyDrive1.Drive.Items[0]);

              // FILE
              xSkyFile := TSkyDriveItem.Create(nil);
              TMSFMXCloudSkyDrive1.SearchList(xCloudFile, true, xSkyFolder);
              xSkyFile := TSkyDriveItem(TMSFMXCloudSkyDrive1.Drive.Items[0]);
              //
              TMSFMXCloudSkyDrive1.Download(xSkyFile, xTargetFile);
            end;

Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2112
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 21 Mar 2019 at 3:11pm
- GDrive: There is no folder path required in the SearchFile function.

- SkyDrive: You can use the result of the SearchList call instead of the Drive collection. 

Example:
var
  xSky: TSkyDriveItem;
  SkyItems: TCloudItems;
begin
  xSky := TSkyDriveItem.Create(nil);
  SkyItems := AdvSkyDrive1.SearchList(Edit1.Text, True, nil);
  xSky := TSkyDriveItem(SkyItems.Items[0]);

Note if the problem persists you can check in your code if the search function has returned the result(s) you expected to find out if the search query was correct.
Back to Top
Marc SPRIT View Drop Down
New Member
New Member
Avatar

Joined: 31 May 2019
Posts: 5
Post Options Post Options   Quote Marc SPRIT Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 2019 at 11:27pm
Have you samples to download and upload specific file (folder + filename without treeview) with Dropbox, OneDrive and Google Drive ?
Back to Top
Cristea Gabriel View Drop Down
New Member
New Member
Avatar

Joined: 12 Jun 2016
Posts: 1
Post Options Post Options   Quote Cristea Gabriel Quote  Post ReplyReply Direct Link To This Post Posted: 01 Jun 2019 at 7:51pm
Nope, i can not manage to do this with no involving treeview :(

Back to Top
Marc SPRIT View Drop Down
New Member
New Member
Avatar

Joined: 31 May 2019
Posts: 5
Post Options Post Options   Quote Marc SPRIT Quote  Post ReplyReply Direct Link To This Post Posted: 01 Jun 2019 at 11:18pm

I regret the purchase of these components, they are unusable without adequate documentation. I will look for another provider who will bring more help
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down