In the application I'm working on, there is a section for users to create "milestones" for an activity. Some of these milestones, when created or edited, need to be entered in Outlook as a meeting request, and sent to a group of individuals who are assigned to that activity. Code in the same section also creates or modifies data stored in a common SharePoint calendar.
I found some sample code (below) in this question
and modified it as below.
Public golApp As Outlook.Application
Public golNameSpace As Outlook.NameSpace
Function Initialise_Outlook() As Boolean
On Error GoTo Init_err
Set golApp = New Outlook.Application
Set golNameSpace = golApp.GetNamespace("MAPI")
Initialise_Outlook = True
Initialise_Outlook = False
Function CreateAppointment(MyStartDateTime As Date, MyEndDateTime As Date, _
MySubject As String, MyLocation As String, _
MyReminder As Boolean, MyBody As String)
Dim objNewAppt As Outlook.AppointmentItem
' Set global Application and NameSpace
' object variables, if necessary.
If golApp Is Nothing Then
If Initialise_Outlook() = False Then
' You'll need to handle this error
' in your own code.
MsgBox "Unable to initialize Outlook. "
Set objNewAppt = golApp.CreateItem(olAppointmentItem)
.AllDayEvent = False
' Set MyProp = .UserProperties.Add("MyClass", olText)
' MyProp.Value = MyClassName
.Start = MyStartDateTime
.End = MyEndDateTime
.Subject = MySubject
' .Categories = MyCategories
.ReminderSet = False
.BusyStatus = olBusy
.Location = MyLocation
.Body = MyBody
If MyReminder = True Then
.ReminderSet = True
.ReminderMinutesBeforeStart = 1
'add recipients here (obviously not the values I'm actually using)
.RequiredAttendees = "email@example.com"
CreateAppointment = True
It appears to work, because the appointment is appearing in my calendar, but the recipient is not getting the meeting request. As a result of the Save and Send actions, I'm getting the following two popups (I assume these have to do with Outlook security).
When I open the appointment in my calendar, the To box and Required Attendees show the email address of the individual I have entered in the code, but the status bar (above the To: box) says "Invitations have not been sent for this meeting". I assumed that the .Send method would actually send the message but that does not seem to be happening.
I am developing this application for a branch of the US govt, and our systems are configured with a custom form which normally pops up whenever we send an email, allowing us to add some classification settings to the message. This popup is not showing up when the .Send method is executed.
I am unable to implement Redemption as I have multiple users and our IT rules prevent us from installing "unapproved" software.