Reputation: 163
I'm trying to concatenate a string into an object, with the format of "[email protected],[email protected],[email protected]"
. However, the parameter is expecting every value in the string to be surrounded by quotes, such as ""[email protected]","[email protected]","[email protected]""
. The error is "Property validation failed", and it is expecting a System.String. How do I go about resolving this?
The exact lines of code are...
$existingconfig = get-mailboxjunkemailconfiguration $_.address
$existingconfig.trustedsendersanddomains += $_.approved_senders
where $_.approved_senders = "[email protected],[email protected],[email protected]"
Upvotes: 1
Views: 913
Reputation: 895
Using Get-MailboxJunkEmailConfiguration -Identity BSmith | Get-Memeber
shows that the TrustedSendersAndDomains property is a multiValuedProperty string, i.e. an Array. You can try changing the value of the $_.approved_senders
into an array with -Split
$existingconfig = get-mailboxjunkemailconfiguration $_.address
$existingconfig.trustedsendersanddomains += ($_.approved_senders -Split ",")
Upvotes: 1