How to access custom or non-TFS system files using PowerShell?

When using PowerShell to retrieve information from TFS, I find that I can get standard fields, but not "Custom" fields. I'm not sure that custom is the right term, but, for example, if I look at the Process Editor in VS2008 and edit the type of the work item, there are fields like the ones listed below with the name, type and name Ref:

Title         String    System.Title
State         String    System.State
Rev           Integer   System.Rev
Changed By    String    System.ChangedBy

I can access them using Get-TfsItemHistory:

Get-TfsItemHistory "$/path" -Version "D01/12/10~" -R 
  | Select -exp WorkItems | Format-Table Title, State, Rev, ChangedBy -Auto

So far so good.

However, there are other fields in the WorkItem type that I call the Custom or Non-Systemic fields, for example:

Activated By  String    Microsoft.VSTS.Common.ActivatedBy
Resolved By   String    Microsoft.VSTS.Common.ResolvedBy

And the following command does not retrieve data, just spaces.

Get-TfsItemHistory "$/path" -Version "D01/12/10~" -R 
  | Select -exp WorkItems | Format-Table ActivatedBy, ResolvedBy -Auto

, , . "" ?

UPDATE:

:

Get-TfsItemHistory "$/Hermes/Main" -Version "D01/12/10~" -Recurse `
  | Select ChangeSetId, Comment -exp WorkItems `
  | Select ChangeSetId, Comment, @{n='WI-Id'; e={$_.Id}}, Title -exp Fields `
  | Where {$_.ReferenceName -eq 'Microsoft.VSTS.Common.ResolvedBy'} `
  | Format-Table ChangesetId, Comment, WI-Id, Title, @{n='Resolved By'; e={$_.Value}} -Auto

: WorkItem WI-Id , Id . " " "".

+3
1

Fields, . :

Get-TfsItemHistory . -r -vers "D12/14/2010~" | 
    Where {$_.WorkItems.count -gt 0} | Select -Expand workitems | 
    Select @{n='WIT-Id';e={$_.Id}},Title -Expand Fields | 
    Where {$_.ReferenceName -eq 'Microsoft.VSTS.Common.ActivatedBy'} | 
    Format-Table Value,WIT-Id,Title -auto
+3

Source: https://habr.com/ru/post/1780731/


All Articles