Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether a local file is the latest version in tfs?

Tags:

c#

tfs

tfs-sdk

I want to be able to interrogate TfsTeamProjectCollection and determine if there is a newer version of a file on the server. I would like to be able to do this without actually fetching the file.

Is this possible somewhere? I've done some scratching around and so far drawing blanks.

Thanks.

like image 846
Lee Avatar asked Oct 22 '22 21:10

Lee


1 Answers

The easiest way is to QueryHistory between the workspace version and the latest version; if they differ, there exists a newer latest version on the server. Eg:

versionControlServer.QueryHistory(
    serverPath,
    VersionSpec.Latest,
    0,
    RecursionType.Full,
    new WorkspaceVersionSpec(workspace),
    versionFrom,
    null,
    Int32.MaxValue,
    true,
    true);
like image 117
Edward Thomson Avatar answered Nov 01 '22 09:11

Edward Thomson