Does the Vault Client API have a way to get Local Version #

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
HenryEI
Posts: 8
Joined: Fri Dec 16, 2016 12:44 pm

Does the Vault Client API have a way to get Local Version #

Post by HenryEI » Wed May 03, 2017 3:02 pm

I need to use the Vault API to get the Local Version number being displayed on Vault to get my interface working properly. I have seen old posts with people asking for such a feature, but I never saw if it was added, and have not found a way to access it in my own inquiries.

Has this been added? If not is there a work around?

Here is what I want: Given a VaultClientFile, return the Local Version Number shown on Vault.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Does the Vault Client API have a way to get Local Versio

Post by Beth » Wed May 03, 2017 3:26 pm

Did you check out this post here?
viewtopic.php?f=32&t=13968&p=58791

I'm going to move this question over to the Development Tips part of the forum so it is with the other API questions. If you have not seen that section, that's the place to check (viewforum.php?f=39).
Beth Kieler
SourceGear Technical Support

HenryEI
Posts: 8
Joined: Fri Dec 16, 2016 12:44 pm

Re: Does the Vault Client API have a way to get Local Versio

Post by HenryEI » Wed May 03, 2017 4:09 pm

Thank you for the reply. I had not seen that post, however it does not seem to work.

When I tried recreating this line:

WorkingFolder wf = ClientInstace.TreeCache.GetBestWorkingFolder(f.Parent);

It turned out that .GetBestWorkingFolder now returns a string, and not a working folder object so that did not work.

jclausius
Posts: 3617
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Does the Vault Client API have a way to get Local Versio

Post by jclausius » Thu May 04, 2017 11:06 am

Where did you get the VaultClientFile object from? From the current repository? If so, :

VaultClientFile f;
long nObjectID = f.ID;
long nVersion = f.Version;
long nObjectVersionID = f.ObjVerID;
Jeff Clausius
SourceGear

HenryEI
Posts: 8
Joined: Fri Dec 16, 2016 12:44 pm

Re: Does the Vault Client API have a way to get Local Versio

Post by HenryEI » Thu May 04, 2017 3:13 pm

I did get the VaultClientFile from the current repository, but the information you just gave me gives me the "Remote Version" number displayed in Vault. I want the "Local Version" number.

I have no issue getting the Remote Version Number or the Status, but that Local Version number is extremely important to my current project.
Attachments
LocalVersion.PNG
The Local Version
LocalVersion.PNG (29.25 KiB) Viewed 7585 times

jclausius
Posts: 3617
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Does the Vault Client API have a way to get Local Versio

Post by jclausius » Thu May 04, 2017 3:18 pm

Sorry. Had the wrong version in mind. Try this :

VaultClientFile file = <some vault client file from the repository>;
WorkingFolder wf = ClientInstance.GetWorkingFolder(file);
long localVersion = wf.GetDisplayVersion(file);
Jeff Clausius
SourceGear

HenryEI
Posts: 8
Joined: Fri Dec 16, 2016 12:44 pm

Re: Does the Vault Client API have a way to get Local Versio

Post by HenryEI » Thu May 04, 2017 3:40 pm

That worked perfectly! Thank you so much.

jclausius
Posts: 3617
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Does the Vault Client API have a way to get Local Versio

Post by jclausius » Thu May 04, 2017 3:43 pm

No problem. I'm glad I was able to get you what you needed.
Jeff Clausius
SourceGear

Post Reply