如何检测 Type/Modality 的 Lync 对话?

How to detect Type/Modality of Lync Conversation?

我需要检查对话是语音通话还是聊天。 检查需要在触发 ConversationManager_ConversationAdded 事件时进行。

        private void InitialisiereLyncClient()
        {
            //(Running Lync instance)
            m_LyncClient = LyncClient.GetClient();
            ConversationManager m_ConversationManager = m_LyncClient.ConversationManager;


            m_ConversationManager.ConversationAdded += M_ConversationManager_ConversationAdded;
            m_ConversationManager.ConversationRemoved += M_ConversationManager_ConversationRemoved; 
        }

这里我想看看是什么Conversation来处理以后的动作

        //Eigenschaften der Conversation
        IDictionary<ConversationProperty, object> m_properties = e.Conversation.Properties;

        //Informationen der Person, die das Event ausgelöst hat
        Contact m_caller = e.Conversation.Properties[ConversationProperty.Inviter] as Contact;

问题: 我如何区分对话是 Audio/Video 通话还是聊天对话?

我找到了有效的解决方案。

        bool hasAVModality = e.Conversation.Modalities.ContainsKey(ModalityTypes.AudioVideo);
        if (hasAVModality)
        {
            //State of AV modality
            var state = e.Conversation.Modalities[ModalityTypes.AudioVideo].State;
            //Notified = Incoming
            if (state == ModalityState.Notified)
            {
                //Do Something with the call
            }
        }