title: How to create an appointment in outlook with vb?
body: <p>I have a winforms application and I'm trying to create a method that will create a new Outlook appointment. 
  I am using the following code, but Mark an error in the part of the creation of the object <code>newAppointment</code>.</p>
  
  <pre><code>Private Sub AddAppointment()
      Dim newAppointment As Outlook.AppointmentItem = Me.Application.CreateItem _
           (Outlook.OlItemType.olAppointmentItem)
      Try
          With newAppointment
              .Start = Date.Now.AddHours(2)
              .End = Date.Now.AddHours(3)
              .Location = "ConferenceRoom #2345"
              .Body = _
                  "We will discuss progress on the group project."
              .Subject = "Group Project"
              .AllDayEvent = False
              .Recipients.Add("Roger Harui")
              Dim sentTo As Outlook.Recipients = .Recipients
              Dim sentInvite As Outlook.Recipient
              sentInvite = sentTo.Add("Holly Holt")
              sentInvite.Type = Outlook.OlMeetingRecipientType.olRequired
              sentInvite = sentTo.Add("David Junca")
              sentInvite.Type = Outlook.OlMeetingRecipientType.olOptional
              sentTo.ResolveAll()
              .Save()
              .Display(True)
          End With
      Catch ex As Exception
          MessageBox.Show("The following error occurred: " &amp; _
              ex.Message)
      End Tryenter code here
  End Sub
  </code></pre>