Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AcquireFiles, Only download new files

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mhumes
788 Views, 3 Replies

AcquireFiles, Only download new files

Hello Everyone, I am writing a small program that scans a certian folder in my vault and downloads all the PDFs. I have it set up using AcquireFiles and it works correctly but I don't want to download all the PDF files everytime. Is there a way to only download the files that are newer than what I have already?

 

I am programming C# if that helps.

Tags (2)
3 REPLIES 3
Message 2 of 4
wayne.brill
in reply to: mhumes

Hi,

 

I asked a colleague in engineering about this. Here is their reply:

 

 

>> >>

I believe the VDF acquire files API will download a file to disk so long as the file to be downloaded is different than the one that is currently on disk. There are some restrictions that might be enforced that could prevent the download, but that is the general idea. However, you can extend the behavior of the acquire using the events on the AcquireFilesSettings object to avoid downloading files based on your own custom criteria.

 

 

On the AcquireFilesSettings.AcquireFileExtensibilityOptions class (which can be accessed using the AcquireFileSettings.OptionsExtensibility property for a specific instance of the download settings), there is a PreFileAcquire event. You can register a handler to this event which will fire for each file that is to be downloaded. As part of the event arguments, the handler is provided info about the file that is on disk relative to the file to be downloaded. This info can be accessed via the PreFileAcquireEventAgrs.FileAcquisitionInfo property. The property contains an enum with flags that will specify if the file on disk is newer. If you don’t want to download an older version of a file, have the custom handler check for that flag and set the SkipDownload flag on the PreFileAcquisitionResult property of the event args. Hopefully this will give the customer the behavior they want.

 

 

It depends on the customer’s implementation of how they are going about downloading these PDF’s with the acquire files behavior. The VDF AcquireFiles API is written to avoid exess calls to the server whenever it can and so it will not download files if it determines that the file on disk matches the file that is attempting to be downloaded. If the customer’s code is simply collecting up the latest versions of all the PDF files and downloading them, the VDF will only download files that don’t already match what is on disk, so the customer might not need to worry about implementing this handler at all. They can check to for this by simply running their download twice and verifying with fiddler or something that no “DownloadFilePart” calls are being made on the second run because all files should be up to date.

 

 

Alternatively, they could use the Vault Status to determine which files on disk are not the latest and only acquire that subset of files.

<< <<

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
mhumes
in reply to: wayne.brill

Wayne,

 

I appreiate your colleague explaining this all to me. At this point I have already finished the code with custom checks on the file status like he suggested. 

Message 4 of 4
raziusyed
in reply to: mhumes

Hello!

I am trying to make similar program, but I'm stuck on how to scan a particular folder. Do you mind if I see your code? Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report