Forum Discussion
Mats Warnolf
May 03, 2017Brass Contributor
expanding a System.Collections.Generic.List[string]
Im using the following code to add properties to an object $ten = Get-MsolCompanyInformation -TenantId $tenantItem
$objTenantData = New-Object -TypeName system.object
$objTenantData | Add-Member ...
- May 09, 2017I am assuming that the Add-member line is just one of many you want to add to the $objTennantData object and that you want the string array added as a single value (let me know if these assumptions are incorrect)
If so, for any properties that are arrays use the following:
$objTenantData | Add-Member -Type NoteProperty -Name AuthorizedServiceInstances -value ($ten.AuthorizedServiceInstances -join ' ')
Note: You can put other symbols in the ' ' after join and that is what will separate each value in the new string.
Peter McDonald
May 09, 2017Iron Contributor
I am assuming that the Add-member line is just one of many you want to add to the $objTennantData object and that you want the string array added as a single value (let me know if these assumptions are incorrect)
If so, for any properties that are arrays use the following:
$objTenantData | Add-Member -Type NoteProperty -Name AuthorizedServiceInstances -value ($ten.AuthorizedServiceInstances -join ' ')
Note: You can put other symbols in the ' ' after join and that is what will separate each value in the new string.
If so, for any properties that are arrays use the following:
$objTenantData | Add-Member -Type NoteProperty -Name AuthorizedServiceInstances -value ($ten.AuthorizedServiceInstances -join ' ')
Note: You can put other symbols in the ' ' after join and that is what will separate each value in the new string.