How do I create calendar entries for tasks? RRS feed

  • Question

  • I would like to create calendar entries and reminders for recurring tasks. So if I have a task coming up I would like to see an entry in the calendar to show when I have to do it.
    Saturday, January 4, 2014 9:00 PM


  • Hi Mike,

    The NameSpace class from the Outlook Object Model provides the GetDefaultFolder method which allows you to get the Calendar folder by passing the olFolderCalendar value as a parameter. The Store class provides the GetDefaultFolder method specific to the particular store (not profile). Then you can use the Add method of the Items class (see the corresponding property of the Folder class) for adding new items to the Calendar. For example:

    Sub AddNewCalendarItem() 
     Dim myNamespace As Outlook.NameSpace 
     Dim myFolder As Outlook.Folder 
     Dim myItem As Outlook.AppointmentItem 
     Set myNamespace = Application.GetNamespace("MAPI") 
     Set myFolder = myNamespace.GetDefaultFolder(olFolderCalendar) 
     Set myItem = myFolder.Items.Add 
    End Sub

    • Edited by Eugene Astafiev Sunday, January 5, 2014 2:53 PM the sample code is added
    • Marked as answer by Marvin_Guo Monday, January 13, 2014 11:18 AM
    Saturday, January 4, 2014 9:18 PM