I'm trying to remove only the SIP address from a user account via my C# application. I can successfully remove it via the exchange management shell with the following command.
Set-Mailbox "identity" -EmailAddresses @{Remove="sip: firstname.lastname@domain.com"}
In my c# app I've got the following but I'm not sure how to get the "@{Remove="sip:firstname.lastname@domain.com"}" in there.
string termUserEmail = txtboxTermFirstName + "." + txtboxTermLastName + "@domain.com";
PSCommand command1 = new PSCommand();
command1.AddCommand("Set-Mailbox");
command1.AddParameter("Identity", termUserEmail);
var sipAddress = new Hashtable();
sipAddress.Add("remove", termUserEmail);
command1.AddParameter("EmailAddresses", sipAddress);
So, I'm not sure how to get this thing to execute the command correctly. I did look at C# - Remove Exchange Email Address via Powershell Runspace which gt me this far.