简体   繁体   中英

Skype for Business Using Lync 2013 SDK- AutomationModalitySettings.FirstInstantMessage Not Working

I have the following code used to start an IM conversation-

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;
                    }
                }
            }
        }

The code creates an IM convo perfectly with the title and everything; however in my environment (using Skype for Business), the first message does not send, ALTHOUGH in a friend's environment using Lync 2013 he has no issues with the first message sending.

Has anyone heard of anything like this?

Thank you in advance for any assistance provided.

我不确定是什么原因导致该问题,但是可以接受的解决方法是使用StartConversationCallBack发送第一条消息

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM