I use the Lync SDK 2013 and try to check if a new conversation is incoming or outgoing. I don't want to check for audio/video calls only, I want to check in on each modality type.
private void Conversation_Added(object sender, ConversationManagerEventArgs e)
{
Conversation conversation = e.Conversation;
IDictionary<ModalityTypes, Modality> modalities = conversation.Modalities;
bool conversationIsIncoming = modalities.Any(modality => modality.Value.State == ModalityState.Notified);
}
When the event gets triggered and it comes to the Any
method I get this error
NullReferenceException object reference not set to an instance of an object. System.Collections.Generic.KeyValuePair.Value.get returned null.
So obviously I have to use a null check here but maybe the whole code may be wrong? How can I check if the conversation is incoming or outgoing?