Create folder with CloudStorage using full path

Hi. I am trying to create a subfolder with AdvGDrive and AdvDropbox. I know a full Windows-like path, e.g. firstfolder\subfolder1\subfolder2\folder2create

So I use the following code, where fpath is a full path to the folder I need to create:

   CloudItem := nil;
   CloudItems := CloudAccounts[cbCloudAccounts.ItemIndex].Storage.GetFolderList(nil);
   st := '';
   for i := 1 to length(fpath) do begin
       if (i = length(fpath))  then begin
             st := st + fpath[i];
             CloudAccounts[cbCloudAccounts.ItemIndex].Storage.CreateFolder(CloudItem, st);
       end
       else if (fpath[i] = '\') then begin
             for k := 0 to CloudItems.Count-1  do begin
                  if CloudItems.Items[k].FileName = st then begin
                     CloudItem := CloudItems.Items[k];
                     CloudItems := Counts[cbCloudAccounts.ItemIndex].Storage.GetFolderList(CloudItem);                            st 
                     st := '';
                     break;
                  end;
             end;
       end
       else
            st := st + fpath[i];
   end;

But I get the exception "Missing Folder ID" (for AvdGDrive) on line
CloudItems := CloudAccounts[cbCloudAccounts.ItemIndex].Storage.GetFolderList(CloudItem);

If I use Dropbox, the exception is "Missing folder path" on the same line of code.
Please help.

Hi,

The error message you are seeing indicates the reference to the CloudItem object is lost and therefore the required ID or path is no longer available.
Can you please make sure the reference to the CloudItem object is still available before calling GetFoldderList(CloudItem)?
If the problem persists, please provide a ready to run sample project that demonstrates the issue so I can further investigate this.