Sdílet prostřednictvím


Creating an Appointment with CDOEX (Visual Basic)

Topic Last Modified: 2006-06-12

Example

Visual Basic

Note

The following example uses a file URL with the Exchange OLE DB (ExOLEDB) provider. The ExOLEDB provider also supports The HTTP: URL Scheme. Using The HTTP: URL Scheme allows both client and server applications to use a single URL scheme.

' Creating an Appointment with CDOEx
Private Sub AddAppointment()
    Dim strDomainName As String
    Dim strLocalPath  As String
    Dim strContainerURL As String

    Dim iAppointment As New CDO.Appointment

    ' Create the container URL.
    strDomainName = "user1.subdomain.example.com"
    strLocalPath = "MBX/user1/Calendar"
    strContainerURL = "file://./backofficestorage/" & strDomainName & "/" & strLocalPath

    ' Set the appointment properties and save.
    With iAppointment
        .Subject = "CDO For Exchange Programming Discussion"
        .Location = "My office"
        .TextBody = "We will discuss CDO for Exchange 2000 programming"
        .StartTime = "12/25/1999 11:00 AM"
        .EndTime = "12/26/1999 11:00 AM"
        .DataSource.SaveToContainer (strContainerURL)
    End With

    Set iAppointment = Nothing
End Sub