tfs-sdk

TFS API BranchObjectCreated Event does not fire

浪子不回头ぞ 提交于 2019-12-10 17:40:22
问题 I have some code to automate the creation of build definitions in TFS. Now I'd like to have this code invoked whenever a branch is created. Looking at the API, I see that there is a BranchObjectCreatedEvent in Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer . So I've added some code to a console app to handle the event. private static void MonitorBranchCreated() { try { TfsTeamProjectCollection tfs = InitialiseTfs(); var vcs = tfs.GetService<VersionControlServer>(); var

Cannot get a list of valid users in TFS for AssignedTo field while creating new Workitems via API

自闭症网瘾萝莉.ら 提交于 2019-12-10 16:09:28
问题 Hi I am trying to create new workitems via the TFS API and this is the method I have used below to get a list of valid users who can be assigned workitems. Somehow, it gives me a null reference exception on validUserSids line. Anyone know what's wrong here? private string[] TFSUsers(string server) { // Get a Reference to Team Foundation Server. TeamFoundationServer tfs = tfsdata.GetTFS(server); // Get a reference to Group Security Service. IGroupSecurityService gss = (IGroupSecurityService

TFS SDK: Query yesterday's builds

拟墨画扇 提交于 2019-12-10 15:35:18
问题 I can query for all builds within a TeamProject as follows: var bServer = teamProjectCollection.GetService<IBuildServer>(); IBuildDetail[] builds = bServer.QueryBuilds("myTeamProject"); This yields all builds within the given myTeamProject . But I am only interested in yesterday's builds. I can obviously filter after I 've gotten the results within builds . Still I am wondering if there exists an overload of QueryBuilds() to get builds within a provided timespan. Background: In my original

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

无人久伴 提交于 2019-12-10 14:50:05
问题 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. 回答1: 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(

Find the tfs path of merged branch

删除回忆录丶 提交于 2019-12-10 14:35:50
问题 Using TFS, I have trunk $/project/trunk and a branch $/project/dev/feature/new_one . I have merged my branch back to trunk as follows: C33($/project/trunk) | \ | \ | C32($/project/dev/feature/new_one) | | | | | | ... I use the TFS API and can find the merge changeset C33. With the method QueryMerges() , I'm able to find the parent changeset C32 with all the changes on the files, but not the information I need :( Is there a way, using the TFS API, to find the repository path of the branch

Get the current iteration path from TFS

不羁的心 提交于 2019-12-10 14:19:45
问题 I'm trying to get the current iteration path for the teams TFS project. The way I'm trying to do this is by using the blog from http://blog.johnsworkshop.net/tfs11-api-reading-the-team-configuration-iterations-and-areas/ . I start by getting the team configurations from the following code: TfsTeamProjectCollection tpc = TFSConncetion(@"http://tfs/url"); var configSvc = tpc.GetService<TeamSettingsConfigurationService>(); var configs = configSvc.GetTeamConfigurationsForUser(projectUri); The

How to get query names that references the particular iteration path

喜欢而已 提交于 2019-12-08 03:51:13
问题 With selected project name, I had loaded iteration paths. Now I need to get the query names that references the selected iteration path. Code to load iteration paths passing project name: private void LoadIterationPaths(string projectName) { var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_tfs.Uri); var wiStore = tfs.GetService<WorkItemStore>(); var projCollections = wiStore.Projects; var detailsOfTheSelectedProject = projCollections.Cast<Project>().Where(project => !String

Using the TFS 2010 API to subscribe to Workspace Events

微笑、不失礼 提交于 2019-12-08 01:55:08
问题 I'm trying to write some code that monitors the TFS workspace(s) on my local workstation but at the moment I'm having problems getting the events to fire. For example if I map a new folder in my workspace I want to subscribe to the versionControl.UpdatedWorkspace event, and if I do a “get” I want to map to the versionControl.Getting event. The code below is a console application that I think should work, but when I do a get nothing happens. Does anyone know how to successfully subscribe to

Detect file delete changes with TFS API (automated, without VS interaction)

 ̄綄美尐妖づ 提交于 2019-12-07 21:38:45
问题 I have a local folder within the tfs workspace and use the TFS-API. Every night i do delete this folder and and after that script a database as .sql files. If now something was added or edited, the changes will be found and get into the pending changes to checkin. The question is how i can detect with the TFS-API that a file is missing (intentionally, because no longer in database and becaus of that no longer scripted). The first step is obvious, delete all files and script all in the empty

Authenticating to hosted TFS: TF30063: You are not authorized to access .visualstudio.com

99封情书 提交于 2019-12-07 18:00:20
问题 I'm trying to connect to TFS on visualstudio.com through c# and am getting auth errors TF30063: You are not authorized to access [subdomain].visualstudio.com. Here is how I'm trying to enter the username and the password, which are 100% for sure correct, I can login through the website by copying and pasting the u/n & pass, and the account is part of the collection and projects. var tfsServer = TfsConfigurationServerFactory.GetConfigurationServer(new Uri(server)); tfsServer.Credentials = new