Page 1 of 1

How do I get the last modified date of a file?

Posted: Fri Oct 18, 2013 5:35 am
by HMortlock
We are running an extract from the Vault Database and comparing it with files on our network to check the lastest versions of exe and dll files are in SourceGear Vault database.

We are currently getting a collection of VaultHistoryItems and using the VaultHistoryItem.TxDate as this appears to be the last checked in date.

On the Client I can see in the 'File Properties' 'General' tab - a 'Latest In Repository' - 'Modified date'. We want to extract this date but I'm not sure how to get hold of it in the API?

Any help appreciated.

Thanks :)

Re: How do I get the last modified date of a file?

Posted: Fri Oct 18, 2013 8:35 am
by jclausius
Within the API, after login and setting the active repository id, do you see a ServerOperations.client.ClientInstance.TreeCache.Repository.Root object? This will member variable will contain a tree like structure (with folders) full of VaultClientTreeObjects. Each object within the tree will have a VaultClientTreeObject.ModifiedDate for the date the file was last modified and a VaultClientTreeObject.TxDate for the date of the transaction which created that version of the object.

So, if you login, set the active repository id, call Refresh() on ClientInstance to make sure your local repository tree is the latest, walking the tree should provide the information that you need.

HTH

Re: How do I get the last modified date of a file?

Posted: Mon Oct 21, 2013 9:35 am
by HMortlock
Thanks for your help Jeff,

The 'ServerOperations.client.ClientInstance.TreeCache.Root' object seems to return a VaultClientFolder rather than the VaultClientTreeObject, so I've used the FindTreeObjectRecursive method on this and its given me the VaultClientTreeObject and the modified date.

Wouldn't have had a clue without your guidance so thanks. :D

Re: How do I get the last modified date of a file?

Posted: Mon Oct 21, 2013 1:08 pm
by jclausius
NP. Glad it worked. FWIW, VaultClientFolder and VaultClientFile are subclasses of VaultClientTreeObject.