2

I connected to VSTS Server by using:

$teamProjectCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection("http://wonderful01:8080")

$ws = $teamProjectCollection.GetService([type]"Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore")

$closebug=$ws.getworkitem(801089)

After that I ran $closebug, and got one of the items I need to modify:

Value                    : Fixed
OriginalValue            : Fixed
FieldDefinition          : Microsoft.TeamFoundation.WorkItemTracking.Client.FieldDefinition
Id                       : 10001
Name                     : Substatus
ReferenceName            : Microsoft.SQL.Substatus
IsDirty                  : False
IsEditable               : True
IsComputed               : False
IsRequired               : True
AllowedValues            : {Verification Not Needed, Verified}
HasAllowedValuesList     : True
IsLimitedToAllowedValues : True
ProhibitedValues         : {}
HasPatternMatch          : False
Status                   : InvalidListValue
IsValid                  : False
WorkItem                 : Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem

So how can I change the vaule from "fixed" to "verified"?

pansal
  • 269
  • 3
  • 9
  • 20

1 Answers1

2

I am coming to answer my question. After a long time investigation I found that substatus could be invoked by:

$closebug.fields[54]

To change value from "fixed" to "resolved", use:

$closebug.fields[54].value="resolved"

Then update the change:

$closebug.save()

I am not quite understanding why it works, and I think there should be a better way to do it. Welcome comments.

pansal
  • 269
  • 3
  • 9
  • 20