Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] Third Party Tools

Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 05-20-2010, 03:29 PM
rollmj rollmj is online now
Registered User
Join Date: 04-09-2007
Location: mn
Posts: 2
Associate TFS work item with checkin of file

Does anyone know how to associate a work item with the checkin of a particular file using the Team Foundation action in VBP? I'm currently using v7.5 of VBP and cannot seem to figure out a way to associate work items via the command-line.
Reply With Quote
Old 05-20-2010, 03:57 PM
kinook kinook is online now
Join Date: 03-06-2001
Location: Colorado
Posts: 5,851
Reply With Quote
Old 06-19-2014, 09:00 AM
Philip Beck Philip Beck is online now
Registered User
Join Date: 06-19-2014
Posts: 2
trying to associate TFS workitem with TFS check in

The link says that you can associate the work item with the check in in two separate steps, but I don't think this will work in our situation. This is because:-

1. Performing the check in first (before doing the association) is rejected due to our check in policy. The check in hasn't been associated with a work item.

2. Performing the association first is impossible before the changeset doesn't exist yet. The changeset only exists once files have been checked in.

So as far as I can tell, until the parameters for TF CHECKIN allow for something like /workitem:<123>, the only way that it is possible is to use VBScript to use the TFS automation model or write a component that uses the TFS API. I'm not sure which is true as I'm just about to start looking...

Reply With Quote
Old 07-07-2014, 07:36 AM
Philip Beck Philip Beck is online now
Registered User
Join Date: 06-19-2014
Posts: 2
I finally managed to do the association during checkin using a powershell script and reflection on the TFS object model.

Google Get-TfsCollection and then my final few lines looked like this:

$col = Get-TfsCollection("http://xxxxxxxxxxxx:8080/tfs/DefaultCollection")

$wis = Get-TfsWorkItemStore($col)

$vcs = Get-TfsVersionControlServer($col)

$wi = $wis.GetWorkItem(1234)

$ws = $vcs.GetWorkspace("C:\xxxxxxxx")

$pc = $ws.GetPendingChanges()

$wici = Get-TfsWorkItemCheckinInfo($wi)

$changeset = $ws.CheckIn($pc, "xxxxx", $null, $wici, $null)
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

All times are GMT -5. The time now is 03:09 PM.

Copyright 1999-2022 Kinook Software, Inc.