I am attempting to execute a script for single contact IM (via Microsoft Lync), and have successfully ran the script all the way down to the last line:
$null = $m.BeginSendMessage($d, $null, $d)
Note:
$d = New-Object "System.Collections.Generic.Dictionary [Microsoft.Lync.Model.Conversation.InstantMessageContentType, String]"
$d.Add($PlainText, "This is a test.")
Below is the exception Psh is throwing upon execution of this syntax. It appears to fail at initiation of the $null variable.
Exception calling "BeginSendMessage" with "3" argument(s): "Value does not fall within the expected range."
At C:\ScriptsPS\IM_SingleContact.ps1:75 char:1
+ $null = $m.BeginSendMessage($d, $null, $d)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~