Page 1 of 1

VersionHistoryBegin method of the VaultConnection class

Posted: Tue Jan 01, 2008 8:54 pm
by chris
Is there any documentation on the method and class stated above?

I'm having problem figuring out how to make use of this function. I can't retrieve the version information of the root folder that i need.

public void VersionHistoryBegin(int nRowLimit, int nRepID, long nObjID, DateTime dtBeginRange, DateTime dtEndRange, long nStartVersion, ref int nRowsRetrieved, ref string strQryToken);

What is the nObjID parameter?



I'm using the Vault 3.19 API.

Posted: Tue Jan 01, 2008 9:18 pm
by jclausius
First you call BeginXXXQuery to start the history query on the server. The Object ID is the ID property of the item found within the tree cache.

After a successful call, you pick up the results with the Fetch method.

Since the results are cached on the server, you close the query with EndXXXQuery.

Posted: Tue Feb 26, 2008 12:48 pm
by mmoayyed
Could anyone help me figure out how to call this method in VaultClientAPI_4_0_5_15922 ??

This is the signature:
public void VersionHistoryBegin(int nRowLimit, int nRepID, long nStartVersion, VaultHistoryQueryRequest hqr, ref int nRowsRetrieved, ref string strQryToken);


...and this is how I have tried to call it:

file is a VaultClientFile;


int retrieved = 0;
String token = String.Empty;

VaultHistoryQueryRequest request = new VaultHistoryQueryRequest();

request.IsFolder = false;
request.Recursive = true;
request.RepID = ActiveRepositoryID;
request.SubstringType = VaultQueryRequestSubstrings.DoNotFilter;
request.DateFilterType = VaultQueryRequestDateTypes.DoNotFilter;
request.CommentFilter = VaultQueryRequestComments.DoNotFilter;
request.TopName = file.FullPath;

moClient.Connection.VersionHistoryBegin(1, ActiveRepositoryID, file.Version, request, ref retrieved, ref token);

moClient.Connection.VersionHistoryEnd(token);

problem is, retrieved is always 0.

Posted: Tue Feb 26, 2008 2:12 pm
by jeremy_sg
If you're using 4.0, then you should be using the VaultClientIntegrationLib call for VersionHistory, which just takes simple strings and ints. For information on how to get started with IntegrationLib, see: http://support.sourcegear.com/viewforum.php?f=31

Posted: Tue Feb 26, 2008 3:39 pm
by mmoayyed
Thanks. I looked at the help and it looks like it specifically retrieves versions for a folder path. I am not sure what that means. By folder path, could that be "$/MyProject" ??

Mainly, what I am looking for is, how I can retrieve version 10 of a specific file inside a project. If my assumption above is correct, I dont think that would be the way to go. I have tried passing it the actual item path "$/MyProject/HelloWorld.cs" and it retrieves none.

I am not at all interested in the different version of a folder. I only care about the different history versions of items (files). Currently, I am retrieving the entire version list and then going through the list one by one to find the version I want. Is there an easier way to do this using VersionHistoryBegin ?

Posted: Tue Feb 26, 2008 3:56 pm
by jeremy_sg
Are you trying to get the contents of version 10, or the details of the transaction that created version 10 (date, user, etc)?

Posted: Tue Feb 26, 2008 3:57 pm
by mmoayyed
Just the details.

Posted: Tue Feb 26, 2008 4:07 pm
by jeremy_sg
You're right, VersionHistory was designed for folders. You can use normal history to get details for files. In ServerOperations.ProcessCommandHistory, you can provide a beginVersion and endVersion to limit the history query. Will that work for you?

Posted: Tue Feb 26, 2008 4:51 pm
by mmoayyed
I'll check again and will get back to you.

Thank you for your time :)