我有以下代码用于启动 IM 对话-
public void IMbtn_Click(object sender, RoutedEventArgs e)
{
var participants = new List<string>();
participants.Add("blabla.com");
if (_lyncAutomation != null)
{
var bridgeNames = _info.Bridges.Where(b => b.Selected && b.Enabled).Select(b => b.Name);
var chatTitle = $"{_info.Title} {string.Join(", ", bridgeNames)}";
string chat = "Welcome to test's chat!";
AutomationModalities mode = AutomationModalities.InstantMessage;
var convoSettings = new Dictionary<AutomationModalitySettings, object>();
convoSettings.Add(AutomationModalitySettings.Subject, chatTitle);
convoSettings.Add(AutomationModalitySettings.FirstInstantMessage, chat);
convoSettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true);
try
{
_lyncAutomation.BeginStartConversation(mode, participants, convoSettings,
StartConversationCallback, null);
}
catch (LyncClientException lyncClientException)
{
MessageBox.Show("Call failed.");
Logger.Log("Exception while creating Lync call: " + lyncClientException);
}
catch (SystemException systemException)
{
if (IsLyncException(systemException))
{
MessageBox.Show("Call failed.");
Logger.Log("Error: " + systemException);
}
else
{
throw;
}
}
}
}
该代码完美地创建了一个包含标题和所有内容的 IM convo;但是在我的环境中(使用 Skype for Business),第一条消息没有发送,尽管在使用 Lync 2013 的朋友的环境中,第一条消息发送没有问题。
有没有人听说过这样的事情?
预先感谢您提供的任何帮助。