Creating Team Foundation Work Items With PowerShell

Here is the simple function I added to my powershell profile:




function create-tfstask ($desc) {
 tfpt workitem /new $workItemType /collection:$serverUrl /fields:"Title=$($desc);Assigned To=$assignee;AreaId=$areaId;IterationId=$iterationId"



To find the AreaId and IterationId for your project/versions, just look at a bug you know is setup correctly:

PS C:\> tfpt query /collection:http://3bs001vsteam:8080/tfs /wiql:"select AreaId,IterationId from workitems where ID = 879"

Next I hooked this into my existing "todo" function by adding a new case in its $target switch statement for “tfs”, which calls my create-tfstask function and returns.  Updated todo function:

function todo {
  param([string] $target = "work",
        [string] $msg )
  $emailFrom = ""
  #combine all the cmd line args into one "message"
  if ($args -ne "") {
    $msg = $msg + " " + $args
  #what is the target of the message?
  switch ($target)
    "work" { $target = "" }
    "home" { $target = "" }
    "tfs" { create-tfstask $msg; return }
  $subject = "Todo: " + $msg
  $body = $msg
  $smtpServer = "3bs001exch"	
  $smtp = new-object Net.Mail.SmtpClient($smtpServer, 25)
  $smtp.Send($emailFrom, $target, $subject, $body)
Technorati Tags: ,,

Print | posted on Wednesday, January 26, 2011 10:58 AM


# re: Creating Team Foundation Work Items With PowerShell

Left by rental sewa mobil bogor at 3/1/2012 12:52 AM
Gravatar prosesor dual-core 1.5 Ghz Snapdragon S3 CPU dengan layar SAMOLED ukuran 4 inchi, kamera belakang 5MP dengan kemampuan merekam video 720P, kamera depan 1.3MP, dan akan beroperasi dengan Android 2.3 Gingerbread. Mengenai konektivitas, ponsel rental sewa mobil bogor ini sudah mendukung 42Mbps HSPA+. Ponsel ini juga akan diberikan aplikasi bawaan seperti DropBox, Evernote, Square, TripIt, Camscanner dan LinkedIn untuk membantu produktivitas pengguna. Sayangnya belum ada informasi mengenai ketersediaan Galaxy S Blaze 4G ini di Indonesia

Your comment:


Copyright © Lance Robinson

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski