DropBox Folder - Fixed FolderName

How can I assign a pre-defined Foldername which already exists to a TCloudItem?
I do not want to allow the user to select the folder by a treeview.
I found some hints in the forum and tried this:

---------------------------------------------------------------------------
var
   i             :  integer;
   cloudItem     :  TCloudItem;
   CloudItemN    :  TcloudItem;
   isFolderFound :  boolean;
begin
   screen.Cursor := crHourGlass;
   isFolderFound := false;
   //---------------------------------- Plausibilit?t - App-Keys m?ssen hinterlegt sein
   if (txtAppKey.Text    = '')
   or (txtAppSecret.Text = '') then begin
      showMessage('Credential-Error: App-Keys for DropBox are missing!');
      PageControl.ActivePageIndex := 2;
      exit;
   end;

   //---------------------------------- Zuweisen der API-Keys
   DropBox.App.Key    := txtAppKey.Text;
   DropBox.App.Secret := txtAppSecret.Text;
   DropBox.Connect;

   //---------------------------------- Kunden-Verzeichnis f?r Upload suchen
   cloudItem := TCloudItem.Create(nil);
   DropBox.GetDriveInfo;                                                        // Gesamte Verzeichnis-Struktur der Dropbox einlesen
                                                                                // Sequentielles abarbeiten der Verzeichnisstruktur-Items
   for i := 0 to DropBox.Drive.Count -1 do begin

      if  (DropBox.Drive.Items.ItemType = ciFolder)
      and (DropBox.Drive.Items.FileName = 'eXtra4_RHMueller') then begin
          cloudItem.Assign(DropBox.Drive.Items);
          isFolderFound := true;
      end;
   end;

   if isFolderFound
   then CloudItemN := DropBox.upload(CloudItem,'C:\Temp\Test.txt')
   else showMessage('Folder not found');

   cloudItem.Free;
   DropBox.Disconnect;
   screen.Cursor := crDefault;

   showMessage('Upload completed');
-----------------------------------------------------------
But at the end I get error message "Integer overflow".  After hours of research it's a little disappointing to have no reference for the component and the manual provides a totally other approach.

Hi,


Please use a TDropBoxItem instead of a TCloudItem and set the Path property separately.

Example:

var
   i:  integer;
   dropBoxItem, dropBoxItemN: TDropBoxItem;
   isFolderFound: boolean;
begin
  isFolderFound := false;
  dropBoxItem := TDropBoxItem.Create(nil);

   AdvDropBox1.GetDriveInfo;

   for i := 0 to AdvDropBox1.Drive.Count -1 do begin
      if not isFolderFound then
      begin
        if  (AdvDropBox1.Drive.Items.ItemType = ciFolder)
        and (AdvDropBox1.Drive.Items.FileName = 'FolderName') then begin
            dropBoxItem.Assign(AdvDropBox1.Drive.Items);
            dropBoxItem.Path := TDropBoxItem(AdvDropBox1.Drive.Items).Path;
            isFolderFound := true;
        end;
      end;
   end;

   if isFolderFound
   then
    dropBoxItemN := TDropBoxItem(AdvDropBox1.upload(dropBoxItem,'e:\Temp\Test.txt'))
   else showMessage('Folder not found');

   dropBoxItem.Free;
end;


Hey Bart,

Great!!!! You're a Pundit.  ;-)
This Command
>>> dropBoxItemN := TDropBoxItem(AdvDropBox1.upload(dropBoxItem,'e:\Temp\Test.txt')) <<<

that's really impressive. Where can you learn about this kind of "capsuled" command.
Nevertheless. Thank you very much.
Alex

Happy to help!