Find the correct folder in Google Drive

Greetings,

My solution requires uploading financial documents by year. The user does not have access to the UI for Google Drive. The solution runs behind the scenes. For example the following folder structure for 2022:
Root-2022
Federal
1040
files a, files b, files c
1099
files a, files b, files c
State
files a, files b, files c ....
Root-2023
Federal
1040
files a, files b, files c
1099
files a, files b, files c
State
files a, files b, files c ....
When I search for the folder name Federal, it just gives me 2 IDs, but I do not get their root folder which makes it difficult to place the documents in the right folder.

In the below callback I can get the IDs for the folder but the parentfolder is always ''.
procedure TForm4.TMSFNCCloudGoogleDrive1Search(Sender: TObject;
const ASearchResults: TTMSFNCCloudGoogleDriveItems;
const ARequestResult: TTMSFNCCloudBaseRequestResult);
var
i,m: integer;
ci: TTMSFNCCloudItem;

begin
i:= ASearchResults.Count;
Memo1.Clear;

ci := AsearchResults.Items[0];

try
for m:= 0 to i-1 do
begin
Memo1.Lines.add(ASearchResults.items[m].ID);
Memo1.Lines.add(ASearchResults.Items[m].FileName);
Memo1.Lines.Add(ASearchResults.Items[m].DownloadURL);
end;

except
ShowMessage('Not found')
end;

Any assistances will be much appreciated.

Hi,

The ParentFolder property is indeed left unassigned because the search request only returns the parent ID. Unfortunately it's currently not supported to retrieve file/folder information based on the ID.

A possible solution could be to search for the parent folder name first. Then use the ID from the parent folder to search for the "Federal" folder inside the parent folder.
You can use the AFolderID parameter of the Search call to search inside a specific folder.