Discuss this help topic in SecureBlackbox Forum

Clouds: Work with file revisions

When the file data are uploaded to the file, which already exists, the old data remain on the server and are accessed via so-called revisions of the file. Revisions are kept for 30 days for a free account. To receive the list of previous file revisions you need to use either TElDropboxDataStorage.ListRevisions() or TElDropboxDataStorageObject.ListRevisions() method. These methods return the list of objects of TElDropboxDataStorageObject class in the same way as List methods return the list of files for the folder.

C#:


TElDataStorageObjectList list = new TElDataStorageObjectList();
storage.ListRevisions(@"/Parent1/Parent2/filename.ext", list);

for (int i = 0; i < list.Count; i++)
{
    TElDropboxDataStorageObject obj = list.get_Objects(i) as
                                      TElDropboxDataStorageObject;
    Console.WriteLine("- {0} (date = {2}, size = {3})",
                      obj.Rev, obj.Modified, obj.Size);
}

list.Dispose();

To download the previous revision from the server, you need to pass the ID of the revision to TElDropboxDataStorage.ReadObject() method. The previous sample shows the revision ID in obj.Rev property.

C#:


FileStream output = new FileStream(@"X:\downloaded.bin", FileMode.Create);
try
{
    storage.ReadObject(@"/Parent1/Parent2/filename.ext", "revision_id", output);
}
finally
{
    output.Close();
}

You can restore any file revision on the server. To do this call TElDropboxDataStorage.RestoreObject() method:

C#:


TElDropboxDataStorageObject restored = storage.RestoreObject(
    @"/path/filename.ext", @"revision_id");
Console.WriteLine("Restored: {0} (size = {1})", restored.Rev, restored.Size);
restored.Release();

How To articles about Dropbox cloud

Discuss this help topic in SecureBlackbox Forum