none
Schedule Skype Meeting from Outlook with C# program RRS feed

  • Question

  • Hi Team,

    I am trying to schedule a "Skype Meeting" with C# programmatically. The below is the code which I tried on same .. but able to schedule a normal meeting programmatically. I should schedule with recurrence as well..... :-) 

    CORRECT ME IF I AM WRONG ....

    "OlItemType.olAppointmentItem" means normal meeting is scheduling... but unable to get the skype meeting.....

    PLEASE HELP ME OUT .. THIS IS VERY URGENT... :-)

    try

                {

                    Microsoft.Office.Interop.Outlook.Application OutlookApp = new Microsoft.Office.Interop.Outlook.Application();

                    Microsoft.Office.Interop.Outlook.AppointmentItem agendaMeeting = (Microsoft.Office.Interop.Outlook.AppointmentItem)

                        OutlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);

                    SKYPE4COMLib.Application SkypeApplication = new SKYPE4COMLib.Application();

                    //SKYPE4COMLib.GroupCollection g = new GroupCollection();

                    //int co = g.Count;

                    //Microsoft.Office.Interop.Outlook.MeetingItem i =

                    //Microsoft.Office.Interop.Outlook.MeetingItem obj =

                    if (agendaMeeting != null)

                    {

                        agendaMeeting.MeetingStatus =

                            Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;

                        agendaMeeting.Location = "Conference Room";

                        agendaMeeting.Subject = "Discussing the Agenda_C#";

                        agendaMeeting.Body = "Let's discuss the agenda._C#";

                        agendaMeeting.Start = new DateTime(2016, 5, 5, 5, 0, 0);

                        agendaMeeting.Duration = 60;

                        Microsoft.Office.Interop.Outlook.Recipient recipient =

                            agendaMeeting.Recipients.Add("v-narda@microsoft.com");

                        recipient.Type =

                            (int)Microsoft.Office.Interop.Outlook.OlMeetingRecipientType.olRequired;

                        ((Microsoft.Office.Interop.Outlook._AppointmentItem)agendaMeeting).Send();

                    }

                }

                catch (System.Exception ex)

                {

                }


    Wednesday, July 13, 2016 6:10 AM

Answers

  • Hello Ravi,

    The Outlook object model doesn't provide any property or method for scheduling a Skype meeting. You can try to execute the ribbon button programmatically, see CommandBars.Execute method. You just need to pass the idMso value of the built-in control.

    The GetRecurrencePattern method of the AppointmentItem class returns a RecurrencePattern object that represents the recurrence attributes of an appointment.

    If there is no existing recurrence pattern, a new empty RecurrencePattern object is returned.

    Note, when you work with recurring appointment items, you should release any prior references, obtain new references to the recurring appointment item before you access or modify the item, and release these references as soon as you are finished and have saved the changes. This practice applies to the recurring AppointmentItem object, and any Exception or RecurrencePattern object. To release a reference in Visual Basic for Applications (VBA) or Visual Basic, set that existing object to Nothing. In C#, explicitly release the memory for that object. For a code example, see the topic for the AppointmentItem object.

    Note that even after you release your reference and attempt to obtain a new reference, if there is still an active reference, held by another add-in or Outlook, to one of the above objects, your new reference will still point to an out-of-date copy of the object. Therefore, it is important that you release your references as soon as you are finished with the recurring appointment.

    Public Sub cmdExample()  
     Dim myApptItem As Outlook.AppointmentItem  
     Dim myRecurrPatt As Outlook.RecurrencePattern  
     Dim myNamespace As Outlook.NameSpace  
     Dim myFolder As Outlook.Folder  
     Dim myItems As Outlook.Items  
     Dim myDate As Date  
     Dim myOddApptItem As Outlook.AppointmentItem  
     Dim saveSubject As String  
     Dim newDate As Date  
     Dim myException As Outlook.Exception  
      
     Set myApptItem = Application.CreateItem(olAppointmentItem)  
     myApptItem.Start = #2/2/2003 3:00:00 PM#  
     myApptItem.End = #2/2/2003 4:00:00 PM#  
     myApptItem.Subject = "Meet with Boss"  
      
     'Get the recurrence pattern for this appointment  
     'and set it so that this is a daily appointment  
     'that begins on 2/2/15 and ends on 2/2/16  
     'and save it. 
     
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     myRecurrPatt.RecurrenceType = olRecursDaily  
     myRecurrPatt.PatternStartDate = #2/2/2015#  
     myRecurrPatt.PatternEndDate = #2/2/2016#  
     myApptItem.Save 
     
     'Access the items in the Calendar folder to locate  
     'the master AppointmentItem for the new series.  
     Set myNamespace = Application.GetNamespace("MAPI")  
     Set myFolder = myNamespace.GetDefaultFolder(olFolderCalendar)  
     Set myItems = myFolder.Items  
     Set myApptItem = myItems("Meet with Boss") 
     'Get the recurrence pattern for this appointment  
     'and obtain the occurrence for 3/12/16.  
     myDate = #3/12/2016 3:00:00 PM#  
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     Set myOddApptItem = myRecurrPatt.GetOccurrence(myDate) 
     'Save the existing subject. Change the subject and  
     'starting time for this particular appointment  
     'and save it.  
     saveSubject = myOddApptItem.Subject  
     myOddApptItem.Subject = "Meet NEW Boss"  
     newDate = #3/12/2016 3:30:00 PM#  
     myOddApptItem.Start = newDate  
     myOddApptItem.Save 
     'Release references to the appointment series  
     Set myApptItem = Nothing  
     Set myRecurrPatt = Nothing   
     'Get the recurrence pattern for the master  
     'AppointmentItem. Access the collection of  
     'exceptions to the regular appointments.  
     Set myItems = myFolder.Items  
     Set myApptItem = myItems("Meet with Boss")   
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     Set myException = myRecurrPatt.Exceptions.Item(1) 
     'Display the original date, time, and subject  
     'for this exception.  
     MsgBox myException.OriginalDate & ": " & saveSubject 
     'Display the current date, time, and subject  
     'for this exception.  
     MsgBox myException.AppointmentItem.Start & ": " & _  
     myException.AppointmentItem.Subject  
    End Sub 


    [custom.development]

    Wednesday, July 13, 2016 12:05 PM

All replies

  • Hello Ravi,

    The Outlook object model doesn't provide any property or method for scheduling a Skype meeting. You can try to execute the ribbon button programmatically, see CommandBars.Execute method. You just need to pass the idMso value of the built-in control.

    The GetRecurrencePattern method of the AppointmentItem class returns a RecurrencePattern object that represents the recurrence attributes of an appointment.

    If there is no existing recurrence pattern, a new empty RecurrencePattern object is returned.

    Note, when you work with recurring appointment items, you should release any prior references, obtain new references to the recurring appointment item before you access or modify the item, and release these references as soon as you are finished and have saved the changes. This practice applies to the recurring AppointmentItem object, and any Exception or RecurrencePattern object. To release a reference in Visual Basic for Applications (VBA) or Visual Basic, set that existing object to Nothing. In C#, explicitly release the memory for that object. For a code example, see the topic for the AppointmentItem object.

    Note that even after you release your reference and attempt to obtain a new reference, if there is still an active reference, held by another add-in or Outlook, to one of the above objects, your new reference will still point to an out-of-date copy of the object. Therefore, it is important that you release your references as soon as you are finished with the recurring appointment.

    Public Sub cmdExample()  
     Dim myApptItem As Outlook.AppointmentItem  
     Dim myRecurrPatt As Outlook.RecurrencePattern  
     Dim myNamespace As Outlook.NameSpace  
     Dim myFolder As Outlook.Folder  
     Dim myItems As Outlook.Items  
     Dim myDate As Date  
     Dim myOddApptItem As Outlook.AppointmentItem  
     Dim saveSubject As String  
     Dim newDate As Date  
     Dim myException As Outlook.Exception  
      
     Set myApptItem = Application.CreateItem(olAppointmentItem)  
     myApptItem.Start = #2/2/2003 3:00:00 PM#  
     myApptItem.End = #2/2/2003 4:00:00 PM#  
     myApptItem.Subject = "Meet with Boss"  
      
     'Get the recurrence pattern for this appointment  
     'and set it so that this is a daily appointment  
     'that begins on 2/2/15 and ends on 2/2/16  
     'and save it. 
     
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     myRecurrPatt.RecurrenceType = olRecursDaily  
     myRecurrPatt.PatternStartDate = #2/2/2015#  
     myRecurrPatt.PatternEndDate = #2/2/2016#  
     myApptItem.Save 
     
     'Access the items in the Calendar folder to locate  
     'the master AppointmentItem for the new series.  
     Set myNamespace = Application.GetNamespace("MAPI")  
     Set myFolder = myNamespace.GetDefaultFolder(olFolderCalendar)  
     Set myItems = myFolder.Items  
     Set myApptItem = myItems("Meet with Boss") 
     'Get the recurrence pattern for this appointment  
     'and obtain the occurrence for 3/12/16.  
     myDate = #3/12/2016 3:00:00 PM#  
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     Set myOddApptItem = myRecurrPatt.GetOccurrence(myDate) 
     'Save the existing subject. Change the subject and  
     'starting time for this particular appointment  
     'and save it.  
     saveSubject = myOddApptItem.Subject  
     myOddApptItem.Subject = "Meet NEW Boss"  
     newDate = #3/12/2016 3:30:00 PM#  
     myOddApptItem.Start = newDate  
     myOddApptItem.Save 
     'Release references to the appointment series  
     Set myApptItem = Nothing  
     Set myRecurrPatt = Nothing   
     'Get the recurrence pattern for the master  
     'AppointmentItem. Access the collection of  
     'exceptions to the regular appointments.  
     Set myItems = myFolder.Items  
     Set myApptItem = myItems("Meet with Boss")   
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     Set myException = myRecurrPatt.Exceptions.Item(1) 
     'Display the original date, time, and subject  
     'for this exception.  
     MsgBox myException.OriginalDate & ": " & saveSubject 
     'Display the current date, time, and subject  
     'for this exception.  
     MsgBox myException.AppointmentItem.Start & ": " & _  
     myException.AppointmentItem.Subject  
    End Sub 


    [custom.development]

    Wednesday, July 13, 2016 12:05 PM
  • Hi Ravi,

    Are you successful in generating the skype link. If yes, can you help me on that.

    Saturday, November 9, 2019 11:18 AM