I am writing an app that creates an Outlook appointment, shows it for the user to fill in optional parts, then I want to store the entry ID and then be able to retrieve and display that appointment later. I have one question.
I have this code below that creates and displays the appointment. I know that I need to store the Entry ID, but it seems that everywhere I put the code to store the Entry ID, it is blank at that point. Where in the code below do I need to put the entry ID code? Or is the Entry ID only created when I save the appointment?
Thanks...any help would be appreciated.
Note that the above is not my code. It came from a previous post here and I adapted it as I required.
I have this code below that creates and displays the appointment. I know that I need to store the Entry ID, but it seems that everywhere I put the code to store the Entry ID, it is blank at that point. Where in the code below do I need to put the entry ID code? Or is the Entry ID only created when I save the appointment?
Code:
Public Function OutlookAppointment(sAttendees As String, sSubject As String, sLocation As String, strType As String) As String
Dim oAppointment As Outlook.AppointmentItem
Dim oOutlook As Outlook.Application
Dim oFolder As MAPIFolder
Dim oItems As Items
' Start Outlook
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
' Logon
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Set oOutlook = New Outlook.Application
Set oAppointment = Outlook.CreateItem(olAppointmentItem)
'Set meeting parameters
With oAppointment
.Duration = 30 '(in minutes)
.Location = sLocation
If strType = "Meeting" Then
.MeetingStatus = olMeeting
End If
.Subject = sSubject
.BusyStatus = olBusy
.ReminderSet = True
.ReminderMinutesBeforeStart = 30 '(in Minutes)
End With
If strType = "Meeting" Then
'Add attendees
With oAppointment.Recipients.Add(sAttendees)
.Type = 1 '1 = Required, 2 = Optional
End With
End If
oAppointment.Display
Set olApp = Nothing
Set olNs = Nothing
Set oAppointment = Nothing
Set oOutlook = Nothing
End Function
Thanks...any help would be appreciated.
Note that the above is not my code. It came from a previous post here and I adapted it as I required.