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
How do I get the last modified date of a file?
Moderator: SourceGear
Re: How do I get the last modified date of a file?
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
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
Jeff Clausius
SourceGear
SourceGear
Re: How do I get the last modified date of a file?
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.
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.
Re: How do I get the last modified date of a file?
NP. Glad it worked. FWIW, VaultClientFolder and VaultClientFile are subclasses of VaultClientTreeObject.
Jeff Clausius
SourceGear
SourceGear