cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get revision of file from C#

Highlighted

Get revision of file from C#

Explorer | Level 3

Hello, I need to keep syncronized in the memory of my program the contents of a file inside my dropbox, I was thinking on getting constantly the Revision of that file and if it's different, then, download the content. Ignoring if that's the best way to go. It's a really light file, less than 10KB of text.

So, I was thinking this way, in a timer:

            if (!workingAsync)
            {
                workingAsync = true;
                string newRev = (await dBox.Files.GetMetadataAsync("/File.txt")).AsFile.Rev;
                workingAsync = false;

                if (oldRev != newRev)
                {
                    oldRev = newRev;
                    DownloadUpdatedFile();
                }
            }

But I don't know if there's a better way of performing this check.

Thanks for any advice.

 

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Get revision of file from C#

Dropboxer

Checking if the `rev` value has changed is certainly a valid way of determing if your copy of the may be out of date. 

Alternatively, you can make use of the following methods to efficiently keep track of any changes in a particular folder:

ListFolderAsync and ListFolderContinueAsync can be used to list the contents of a folder, and then ListFolderLongpollAsync can be used to efficiently poll for changes to that folder. Check out the linked documentation for each on information on how to use them.

View solution in original post

1 Reply 1
Highlighted

Re: Get revision of file from C#

Dropboxer

Checking if the `rev` value has changed is certainly a valid way of determing if your copy of the may be out of date. 

Alternatively, you can make use of the following methods to efficiently keep track of any changes in a particular folder:

ListFolderAsync and ListFolderContinueAsync can be used to list the contents of a folder, and then ListFolderLongpollAsync can be used to efficiently poll for changes to that folder. Check out the linked documentation for each on information on how to use them.

View solution in original post

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?