I have an object that holds numbers $names
name
123
456
789
012
...
I need to compose a title for an item in TFS like: My Title 123 456 789 012 ...
Add-VSTeamWorkItem -Title "My title $names" -Description "This is a description" -WorkItemType Task
If it will be run in a loop many work items will be created What is the right way to do it?
CodePudding user response:
$numbers = @(1, 2, 3, 4, 5, 6, 7)
$numbers | foreach-object {
Add-VSTeamWorkItem -Title "My title $_" -Description "This is a description" -WorkItemType Task
}
CodePudding user response:
Your sample data suggests that $names
contains an array of objects with a .name
property, and that you want to space-concatenate these property values inside an expandable (double-quoted) string ("..."
):
"My Title $($names.name)"