Can't create subfolders in DropBox

The following code (which works fine for Box.com) doesn't succeed at creating a subfolder in DropBox:


TAdvDropBox *Box = dynamic_cast<TAdvDropBox *>(g_PRCloud);
TTreeNode *NodeItem = NULL;
TTreeNode *CompanyFolder = NULL;
TTreeNode *TechFolder = NULL;
TTreeNode *PayrollFolder = NULL;
TCloudItem *CloudItem = NULL;
TDropBoxItem *InFileUpload = NULL;
TDropBoxItem *UploadFolder = NULL;
TTreeView *FileTree = new TTreeView(GetWindow());
FileTree->Visible = false;
FileTree->ParentWindow = GetWindow()->Handle;
AnsiString acono;
if(cono <= 9) {acono = ("0" + AnsiString(cono));} else {acono = AnsiString(cono);}

Box->GetDriveInfo();
Box->FillTreeView(FileTree);

CompanyFolder = FindBoxItem(FileTree->Items, acono);
if(CompanyFolder == NULL)
{
    Box->CreateFolder(NULL, acono); // Root level
    Box->FillTreeView(FileTree);
    CompanyFolder = FindBoxItem(FileTree->Items, acono);
    if(CompanyFolder == NULL)
    {
        Application->MessageBox(L"Unable to create company folder on cloud storage drive.", L"Error Creating Folder", MB_OK | MB_ICONERROR);
        delete FileTree;
        return false;
    }
}

PayrollFolder = FindBoxItem(CompanyFolder, "Payroll");
if(PayrollFolder == NULL)
{
    CloudItem = static_cast<TCloudItem *>(CompanyFolder->Data); // returns NULL
    Box->CreateFolder(CloudItem, "Payroll"); // Fails - because CloudItem is NULL, creates folder on root directory insteed of in sub-directory
    Box->FillTreeView(FileTree);
    PayrollFolder = FindBoxItem(CompanyFolder, "Payroll");
    if(PayrollFolder == NULL)
    {
        Application->MessageBox(L"Unable to create Payroll folder on Box cloud storage drive.", L"Error Creating Folder", MB_OK | MB_ICONERROR);
        delete FileTree;
        return false;
    }
}



The first folder created in the root directory of the Drop Box account is created successfully, but the following folder that is intended to be created inside that folder, does NOT get created successfully.

In your code comment you write "Fails because CloudItem is NULL", so I assume the root cause of the problem is that you need to retrieve the valid Folder item first before you can create the subfolder.
Are you using the latest version of TMS Cloud Pack?

It does look like something has got broken in the folder creation for DropBox. I just upgraded from 2.6.1 to 2.7.0 (the latest). Went back to the previous version and that looks ok.

We traced & solved this issue. The next update will address this.