C# TFS get the last User that changed a specific File -


based on specific file's location , name, use c# programmatically name of last user have changed file in tfs. (the last change date nice have)

though not directly related, context information, im using following latest tfs based on file's local path:

        var workspaceinfo = workstation.current.getlocalworkspaceinfo(localpath);         using (var server = new tfsteamprojectcollection(workspaceinfo.serveruri))         {             var workspace = workspaceinfo.getworkspace(server);             getrequest request = new getrequest(new itemspec(localpath, recursiontype.full), versionspec.latest);             workspace.get(request, getoptions.overwrite);         }  

thank hints

i created simple code reference:

using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using microsoft.teamfoundation.client; using microsoft.teamfoundation.build.client; using microsoft.teamfoundation.versioncontrol.client;  namespace consoleapplication1 {     class program     {         static void main(string[] args)         {             string tfsurl = "http://tfscollectionurl";             tfsteamprojectcollection ttpc = new tfsteamprojectcollection(new uri(tfsurl));             versioncontrolserver vcs = ttpc.getservice<versioncontrolserver>();             string[] path = { "$/path/to/item.cs" };             itemspec[] itemspecs = itemspec.fromstrings(path, recursiontype.full);             itemspec itemspec = itemspecs.cast<itemspec>().first();             ienumerable<changeset> changesets = vcs.queryhistory(itemspec);             changeset latestchangeset = changesets.cast<changeset>().first();             console.writeline(latestchangeset.committer);             console.writeline(latestchangeset.committerdisplayname);             console.writeline(latestchangeset.owner);             console.writeline(latestchangeset.ownerdisplayname);             console.writeline(latestchangeset.creationdate);             console.readline();         }     } } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -