Search code examples
skype-for-businessskypedeveloper

skype for business automation to outlook


I have to add a feature in Skype for Business to open automatically a new Outlook task window when a call starts, with the phone number of the called/calling contact in the subject field. Is there any addin or api in order to do this? Thank you


Solution

  • With the help of Lync SDK 2013, new conversation added event can be handled where you can also get participant related information. Inside conversation added event handler listen for AVModality state changes. When AVModality state is changed to connected, using Microsoft.Office.Interop.Outlook outlook application can be automated and new task window can be created as given below

    LyncClient lyncClient = new LyncClient();
    lyncClient.ConversationManager.ConversationAdded += OnConversationAdded;
    
    private void OnConversationAdded(object sender, Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs e)
    {
        e.Conversation.Modalities[ModalityTypes.AudioVideo].ModalityStateChanged +=  OnAudioVideoModalityStateChanged;
    }
    
    private void OnAudioVideoModalityStateChanged(object sender, ModalityStateChangedEventArgs e)
    {
        switch(e.NewState)
        {
            case ModalityState.Connected:
                Application oOutlook = null;
                oOutlook = new Application();
                TaskItem oTask  = (TaskItem)oOutlook.CreateItem(OlItemType.olTaskItem);
                oTask.Subject = "Testing";
                oTask.StartDate = DateTime.Now;
                oTask.Display(true);
                break;
        }
    }
    

    For more information : Microsoft.Office.Interop.Outlook, Lync SDK 2013