TMSFNCCloudStorageServices.Delete Result

I'm using the following code to delete multiple DropBox files. It works fine except that the result of the 1st file deletion is always false; subsequent deletions are all true. The first file is in fact deleted correctly with all the others. SelectedItems is a dynamic array of TTMSFNCCloudItems:

for i := 0 to fileCount - 1 do begin
           ci:= selectedItems[i];
           if i = 0 then
              if AdvMessageDlg('Are you sure you want to delete Folder or File(s) starting from: ' +
                               ci.FileName + ' modified: ' + FormatDateTime(FormatSettings.ShortDateFormat + ' ' +
                               ,mtConfirmation,[mbYes,mbNo],0) = mrNo then exit;

           if ci.ItemType = ciFile then
              deleted:= TMSFNCCloudStorageServices1.Delete(ci);
           if deleted then
               AdvMessageDlg('Folder/File: ' + ci.FileName + ' deleted',mtinformation,[mbok],0)
               AdvMessageDlg('Folder/File: ' + ci.FileName + ' not deleted',mtConfirmation,[mbok],0);


Please note that the Delete command is handled asynchronously by default.
You'll need to use the OnDeleteItem event to check the result.

Alternatively you can also enable synchronous calls. This is explained in the "Synchronous Support" topic of the following blog post:

That explains it! Thanks Bart.