Hello
I am currently migrating (with difficulty) my Android application that was written with legacy TMSFMXCloudPack components to the new TMSFNCCloudPack components.
I see that file storage is similar except that when I use the GetFolderListHierarchical or GetFolderList function, the ParentFolder properties of the items are always nil even though I am indeed in a subfolder.
As a result, I cannot upload to the correct target directory (so, files are uploaded in the root drive)
I am using TMSFNCCloudStorageServices because my app can connect to Dropbox, OneDrive, and Drive.
Why is ParentFolder always nil?
Sample code (added on an button2 in CloudStorageDemo) :
My file in drop box : \Demo\Test.cbf
function TForm1.RechercheCloudItem(ci: TTMSFNCCloudItems; sNom: String; cit: TTMSFNCCloudItemType): Integer;
var
bTrouve: Boolean;
i: Integer;
begin
bTrouve := False;
i := 0;
while (i < ci.Count) and (not bTrouve) do
begin
bTrouve := (LowerCase(ci.Items[i].FileName) = LowerCase(sNom)) and (ci.Items[i].ItemType = cit);
Inc(i);
end;
if (bTrouve) then
Result := Pred(i)
else
Result := -1;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
cis: TTMSFNCCloudItems;
ci: TTMSFNCCloudItem;
i: Integer;
begin
TMSFNCCloudStorageServices1.BeginSync;
try
cis := TMSFNCCloudStorageServices1.GetFolderListHierarchical(nil);
i := RechercheCloudItem(cis, 'Demo', ciFolder);
if (i >= 0) then
begin
cis := TMSFNCCloudStorageServices1.GetFolderListHierarchical(cis.Items[i]);
i := RechercheCloudItem(cis.Items[i].Folder, 'Test.cbf', ciFile);
if (i >= 0) then
ci := cis.Items[i];
end;
finally
TMSFNCCloudStorageServices1.EndSync;
end;
end;
At the end, ci points on Test12.cbf but ParentFolder is nil