Get DownloadURLs from different Clouds

Hello,


I have a small problem and I hope you can help me.
At the moment I test your CloudStorageDemo to get more info.

Thats why on TreeviewChange I let show the download url, because I need this information in my app for later access. With the Dropbox API I know, that DownloadUrl is only a temporarely link, thats why I have to use Share.

  if Assigned(TreeView.Selected) then
  begin
    ci := TTMSFMXCloudItem(TTMSFMXCloudTreeViewItem(TreeView.Selected).DataObject);
    if (ci is TDropboxItem) then
      lblPath.Text := (ci as TDropboxItem).Share;
    if (ci is TGDriveItem) then
      lblPath.Text := (ci as TGDriveItem).???;
    if (ci is TOneDriveItem) then
      lblPath.Text := (ci as TOneDriveItem).???;
  end;

The Google Drive API means the alternateLink property in the File resource is to get a link that can be shared for opening the file. But I can't find this REST API command in your source code.

And what will be the property for OneDrive? The OneDrive API is a little bit confus...

Beste regards
Heiko

Okay, I found that for OneDrive I have to use also the Share property but  with TSkyDriveItem, not TOneDriveItem.


if (ci is TSkyDriveItem) then
      lblPath.Text := (ci as TSkyDriveItem).Share;

Now I only need the TGDriveItem property.

Hi,


Can you please try using the WebContentLink property of the TGDriveItem?

Hi Bart, yes, this works! Thanks for your fast response.

Hi Bart,

(ci as TDropboxItem).Share; 

doesn't work anymore. 

In TMSCloudCustomDropbox.GetShare() the first 
url := FAPIBase + '/sharing/list_shared_links'; // btw. there is a slash too much
is NIL and the second
url := FAPIBase + 'sharing/create_shared_link_with_settings';
returns an empty string.

Best regards
Heiko

I was able to investigate the issue, because the json string told me "invalid path".

I looked at the data parameter and there was the file with an NULL string at the end, like filename.pdf%00

So I commented out the special '%' lines in URLEncodePath() and it works.
But the problem should be solved earlier, because we will need this special lines.

oops, i forgot to mention that I use the CloudTreeViewAdapter.TreeView option, to load the folder in a Treeview, like in your demo.

Hi,


Thank you for notifying us.
We are investigating this issue and will report back as soon as possible.

I have not been able to reproduce the issue TMSCloudCustomDropbox.GetShare().
Can you please provide exact steps to reproduce the issue so I can further investigate this?
Please also confirm if this issue can be reproduce with the CloudStorageDemo.

In your CloudStorageDemo change the code in ShowItem().

ci := TTMSFMXCloudItem(TTMSFMXCloudTreeViewItem(TreeView1.Selected).DataObject);
if (ci is TBoxNetItem) then
  (ci as TBoxNetItem).LoadFileInfo;
**if (ci is TDropboxItem) then**

** FileName.Text := (ci as TDropboxItem).Share;**

FileName.AutoSize := False;

// FileName.Text := ci.FileName;

If you compile it for Windows, the result is the correct link.
If you compile it for Android the Filename.Text is empty.

It seems the bold function in the new forum didn't work correct, if you select two lines and click on bold. Then every line will be ** ** and not the start and end of the selection.

My new lines have to been bold:

if (ci is TDropboxItem) then
FileName.Text := (ci as TDropboxItem).Share;

Thank you for the clarification.

This issue has now been resolved.
The update will be available with the next TMS FMX Cloud Pack release.

Hello Bart,

sorry to bother you again. But can you explain, why from some Dropbox files I don't get the shared link, although your component uses the 'sharing/create_shared_link_with_settings' command in TTMSFMXCloudCustomDropBox.GetShare ?

Hello,

GetShare don't work on files, like a~Ä#Ö%Ü&ä(ö)üß.zip
The problem is the URLEncodePath() function, because Dropbox needs the filename in original version not in encoded version.

My solution is to delete the URLEncodePath() call in GetShare().
Now I will get the shared link also for this special filename: ϾЖҨڎۺᾏÇ~Ä#Ö%Ü&ä(ö)üß.zip :smile:

Maybe also in GetLink()?

Thank you for notifying.
This issue has now been fixed and the update will be available with the next release of TMS FMX Cloud Pack.