none
How to make work Skype Meeting on custom Outlook appointment add-in? RRS feed

  • Question

  • Hello Everyone,

    I received task to develop custom add-in for my management (I'm not Office developer). In order to do it I have added ribbon and button with event handler:

    public partial class Ribbon1
        {
            private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
            {
    
            }
    
            private void button1_Click(object sender, RibbonControlEventArgs e)
            {
                try
                {
                    Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application();
                    Microsoft.Office.Interop.Outlook.AppointmentItem newAppointment =
                        (Outlook.AppointmentItem)
                    outlookApplication.CreateItem(Outlook.OlItemType.olAppointmentItem);
                    newAppointment.Start = DateTime.Now.AddHours(2);
                    newAppointment.End = DateTime.Now.AddHours(3);
                    newAppointment.Location = "ConferenceRoom #2345";
                    newAppointment.Body =
                        "We will discuss progress on the group project.";
                    newAppointment.AllDayEvent = false;
                    newAppointment.Subject = "Group Project";
                    newAppointment.Recipients.Add("Roger Harui");
                    Outlook.Recipients sentTo = newAppointment.Recipients;
                    Outlook.Recipient sentInvite = null;
                    sentInvite = sentTo.Add("Holly Holt");
                    sentInvite.Type = (int)Outlook.OlMeetingRecipientType
                        .olRequired;
                    sentInvite = sentTo.Add("David Junca ");
                    sentInvite.Type = (int)Outlook.OlMeetingRecipientType
                        .olOptional;
                    sentTo.ResolveAll();
                    newAppointment.Save();
                    newAppointment.Display(true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("The following error occurred: " + ex.Message);
                }
            }
        }

    Everything works fine until I run this add-in and I want to click "Skype Meeting". Nothing really happens then. Moreover I'm not able to go back to my main Outlook window. My custom appointment is "freezing" and doesn't allow to perform any actions outside.

    Do you have any ideas on how to overcome these two issues?

    Thanks in advance for any suggestions.

    Friday, June 15, 2018 10:01 AM

Answers

  • Hello Mateusz,

    First of all, there is no need to create a new instance of the Application class. Instead, use the Globals.ThisAddin.Application property. See Program VSTO Add-ins for more information.

    There is no reason to display a new appointment modally. So, I'd suggest passing false to the Display method instead:

    newAppointment.Display(false);
    


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Proposed as answer by Terry Xu - MSFT Monday, June 18, 2018 1:48 AM
    • Marked as answer by MateuszBill Monday, June 18, 2018 11:19 AM
    Saturday, June 16, 2018 12:33 AM