EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Upload to specific remote path

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#36691
Posted: 05/10/2016 06:20:09
by Romana Romandini (Standard support level)
Joined: 10/22/2013
Posts: 34

Hi, i need to upload files on specific paths on OneDrive, GDrive and Dropbox.

I already did that in Azure with the handy function WriteObject(ContainerName, Name, Data), where i can set the container name and the full path i want. I really love it.

But OneDrive, GDrive and Dropbox don't have such a lovely function :(
Instead, it requires a TElCustomDataStorageObject.

To make this work i have to know:
- if the folder i need exists (i know i can create it with the CreateFolder function if needed)
- how to set TElCustomDataStorageObject on the path i need

Lets take GDrive as example:
I declare my object as TElGoogleDriveDataStorageObject.
I set my TElGoogleDriveDataStorage inside the .Create parameter.
and now i'm stuck. I don't know how to associate this object to a specific folder (i only have the path string of this folder).

I look the samples, but they take those object from a "List" function, starting from the root. I really don't want to reiterate .List on .List to get my folder object reference (slow and ugly), i also don't have any GUI in my application.

How i can do this?

Thank you
#36692
Posted: 05/10/2016 06:47:03
by Alexander Ionov (EldoS Corp.)

Thank you for the questions.

The Dropbox component also provides WriteObject method that allows to write a file directly to any level of the directory hierarchy:
Code
procedure WriteObject(const Path : string; Data : TElStream;
      Handler : TElCustomDataStorageSecurityHandler)

As you don't use security-related features, set the 3d parameter value to nil/null/Nothing.

Unfortunately, the GDrive and OneDrive access components do not provide a way to get directly to a certain level of the directory hierarchy. The only way by now is to iterate through List method calls.

It's also possible to remember the ID of the destination folder and next time you need it, you can get the corresponding TElGoogleDriveDataStorageObject (or TElOneDriveDataStorageObject) object by calling AcquireObject method and passing the ID to it.

Quote
Romana Romandini wrote:
I declare my object as TElGoogleDriveDataStorageObject. I set my TElGoogleDriveDataStorage inside the .Create parameter.

You don't need to create those objects directly. They are returned from List methods and from AcquireObject methods.


--
Best regards,
Alexander Ionov
#36693
Posted: 05/10/2016 07:01:01
by Romana Romandini (Standard support level)
Joined: 10/22/2013
Posts: 34

Thank you a lot for this answer, i wasted hours trying to get those folder objects :)
#36694
Posted: 05/10/2016 07:24:52
by Alexander Ionov (EldoS Corp.)

You're welcome.

We have How-To articles available online. This can help to save your time.
Dropbox
Google Drive
OneDrive


--
Best regards,
Alexander Ionov

Reply

Statistics

Topic viewed 826 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!