Discuss this help topic in SecureBlackbox Forum

Clouds: Get directory structure and file list

To retrieve the list of objects of certain folder call TElDropboxDataStorage.List() method and pass it the absolute path to the folder.

C#:


TElDataStorageObjectList list = new TElDataStorageObjectList();
storage.List("/Parent1/Parent2/Folder", list);

If you already have an object of TElDropboxDataStorageObject class, you can use it instead of the path:

C#:


TElDataStorageObjectList list = new TElDataStorageObjectList();
storage.List(folder, list);

Note that the list, passed to List() method, is not cleared automatically by the method, and new objects are added to the ones, already present in the list.

Also it is important, that when the list is disposed of, all contained objects are also disposed. If you need to work with some object later, you need to make a copy of it and use the copy.

C#:


for (int i = 0; i < list.Count; i++)
{
    TElDropboxDataStorageObject obj = list.get_Objects(i)
                                      as TElDropboxDataStorageObject;
    if (obj.Directory)
        Console.WriteLine("- folder {0} (path = {1})", obj.Name, obj.Path);
    else
        Console.WriteLine("- file {0} (size = {1})", obj.Name, obj.Size);
}

It's possible to store not the folder or file object itself, but its path on the server. When it's necessary to perform some operation with the file or folder, for which the path is known, you can acquire the object using AcquireObject() method and pass the known path to this method.

How To articles about Dropbox cloud

Discuss this help topic in SecureBlackbox Forum