Platform SDK: Exchange Server

Creating Single Events

A single (nonrecurring) event can be created using either the SingleEvents table or the Events table, which contains the merged contents of the single and recurring tables. Because these tables are linked together, creating an item in one table automatically creates that item in the other table. For more information on the Events table, see Merged Tables.

To create a single event

  1. Get the SingleEvents table from the global Schedule object.
  2. Use the New method to create a new item in the SingleEvents table.
  3. Set the desired properties on the item.
  4. Release the objects.

The following sample code creates a SingleEvent object and sets several properties:

Sub CreateEvent()
    Dim objTable As Object, objItem As Object
    Dim dt As Date
    
    'Get the SingleEvents table from the global Schedule object.
    Set objTable = gobjSchedule.SingleEvents
    
    dt = DateAdd("d", 1, Now)
    
    'Create a new item in the SingleEvents table.
    Set objItem = objTable.New
    
    'Set the desired properties on the item.
    objItem.SetProperties Text:="OLE: CreateEvent " & Now(), _
        Notes:="Notes", _
        StartDate:=LConvertTo32bitDate(dt + 1), _
        EndDate:=LConvertTo32bitDate(dt + 2)

    'Release the objects.
    Set objItem = Nothing
    Set objTable = Nothing
    
End Sub