Hello,
I know I've ran into this before, but cannot remember how I worked around it. I have a CSV that has a list of contact records in it. Like so:
name "deGraft-Johnson, AnneMarie" "Ming, Adwina" "tyers, greg" "Oakley, Heather" "Alexander, Blake"
I'm trying to loop through them and get each contact record, then I'll add it to a distribution group. But I'm getting the following error:
Get-MailContact : Cannot bind parameter 'Identity'. Cannot convert the "@{email =omahony, elizabeth}" value of type "System.Management.Automation.PSCustomObje ct" to type "Microsoft.Exchange.Configuration.Tasks.MailContactIdParameter". At C:\test.ps1:5 char:26 + Get-MailContact -identity <<<< $($email) -resultsize unlimited + CategoryInfo : InvalidArgument: (:) [Get-MailContact], Paramete rBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchang e.Management.RecipientTasks.GetMailContact
From what I can see it's casting the variable into the wrong type, and it's not getting the contact. Can anyone assist? Thanks.
|