Hello,
I hope you can help me.
Following you will find my function to get a file list from an known FolderID in Google Drive.
But the problem is the red marked line throws an exception because the GDribveItems are NIL.
Did I initiate the variable wrong?
function Get_Filelist_GDrive(TMSStorage : TTMSFMXCloudGDrive; out GDriveItems: TGDriveItems) : Boolean;
var
myFolder, CI_Folder : TGDriveItem;
i: Integer;
FolderID: string;
begin
// FolderID is saved and known
myFolder := TGDriveItem.Create(NIL);
try
myFolder.ID := FolderID;
GDriveItems := TGDriveItems.Create(TMSStorage, NIL);
GDriveItems := TGDriveItems(TMSStorage.GetFolderList(myFolder));
for i := 0 to GDriveItems.Count-1 do
begin
// get files
end;
finally
myFolder.Free;
end;
end;
Bart
(Bart)
2
Hi,
Your sample code seems to be working as expected when tested here.
Can you try to enable logging to find out if any errors were encountered?
Logging can be enabled by setting Logging to True and LogLevel to llDetail.
The LOG file is automatically generated in the machine's Documents folder.
Hello,
I thought Looging isn't possible for Android. Does it?
If I try to compile this app to Windows then the IDE doesn't find Controls and Forms in Cloudbase.pas
I found a solution:
function Get_Filelist_GDrive(TMSStorage : TTMSFMXCloudGDrive; out GDriveItems: TGDriveItems) : Boolean;
var
myFolder, CI_Folder : TGDriveItem;
i: Integer;
FolderID: string;
tmpItems : TTMSFMXCloudItems;
begin
// FolderID is saved and known
myFolder := TGDriveItem.Create(NIL);
try
myFolder.ID := FolderID;
GDriveItems := TGDriveItems.Create(TMSStorage, NIL);
tmpItems := TMSStorage.GetFolderList(myFolder);
if tmpItems <> NIL then
begin
GDriveItems := TGDriveItems(tmpItems);
for i := 0 to GDriveItems.Count-1 do
begin
// get files
end;
end;
finally
myFolder.Free;
end;
end;