Powershell syntax for linking workitems
-
8 มีนาคม 2555 17:11
I'm writting a powershell script to link work items together. I've got the C# code, but I'm just not sure how to covert it to powershell.
C#: WorkItemLinkType linkType = store.WorkItemLinkTypes[CoreLinkTypeReferenceNames.Hierarchy];
Powershell: $linkType = $store.WorkItemLinkTypes[CoreLinkTypeReferenceNames.Hierarchy]
C#: workItem.Links.Add(new WorkItemLink(linkType.ReverseEnd, workitemID));
Powershell: $workItem.Links.Add(WorkItemLink(linkType.ReversEnd, $workitemID))
Thanks,
Anthony
ตอบทั้งหมด
-
9 มีนาคม 2555 3:30ผู้ดูแล
Hi Anthony,
Thanks for your post.
If you want to link work items programmatically, we usually suggest you create/add work item links using TFS API, according your description, you have already know how to achieve that using TFS API.
I’m not the PowerShell expert, but I think you can get some helpful information in this article: http://www.peterprovost.org/blog/post/Fun-with-PowerShell-and-TFS-Work-Items.aspx.
How to covert the API(C#) code to PowerShell script, I suggest you can contact PowerShell expert for the better response.
John Qiao [MSFT]
MSDN Community Support | Feedback to us
-
3 พฤษภาคม 2555 19:53
$linkType = $store.WorkItemLinkTypes[[Microsoft.TeamFoundation.WorkItemTracking.Client.CoreLinkTypeReferenceNames]::Hierarchy]
$link = new-object Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemLink($linkType.ReverseEnd, $workitemID)
$workItem.Links.Add($link)- เสนอเป็นคำตอบโดย Noah Coad 3 พฤษภาคม 2555 19:53
- ทำเครื่องหมายเป็นคำตอบโดย Anthony Hunter 4 พฤษภาคม 2555 14:28