ajaac
asked on
VBA Code using Outlook and Redemption to send meetings, new a pointer
The following is the code I'm using to create calendar appointments and meetings.
This is working with the local calendar, but the inventation for a meeting only makes it to the sent items folder, it never actually gets mailed out. I can open outlook and forward the items in the sent items folder to the addressees and they go out just fine.
Does any one have any pointers?
Public Function CreateAppointment(strSubje ct As String, strBody As String, dtStartTime As Date, dtEndTime As Date, bolAllDay As Boolean, Optional strAttendees As String)
On Error GoTo Errexit
Dim OlApp As New Outlook.Application, Appt As Object, safeAppt As Object
Set OlApp = CreateObject("Outlook.Appl ication")
Set Appt = OlApp.Session.GetDefaultFo lder(olFol derCalenda r).Items
Set safeAppt = CreateObject("Redemption.S afeAppoint mentItem")
Set Appt = OlApp.CreateItem(olAppoint mentItem)
safeAppt.Item = Appt
With safeAppt
.Subject = strSubject
.Start = dtStartTime
.End = dtEndTime
.AllDayEvent = bolAllDay
.Body = strBody
If Len(strAttendees) > 0 Then
.RequiredAttendees = strAttendees
.MeetingStatus = olMeeting
End If
.Importance = olImportanceHigh
.ReminderSet = True
.ReminderMinutesBeforeStar t = 30
If Len(strAttendees) > 0 Then
.Send
Else
.Save
End If
End With
Set Appt = Nothing
Set safeAppt = Nothing
Set OlApp = Nothing
Errexit:
If Err <> 0 Then
Debug.Print Err, Err.Description
Stop
End If
End Function
This is working with the local calendar, but the inventation for a meeting only makes it to the sent items folder, it never actually gets mailed out. I can open outlook and forward the items in the sent items folder to the addressees and they go out just fine.
Does any one have any pointers?
Public Function CreateAppointment(strSubje
On Error GoTo Errexit
Dim OlApp As New Outlook.Application, Appt As Object, safeAppt As Object
Set OlApp = CreateObject("Outlook.Appl
Set Appt = OlApp.Session.GetDefaultFo
Set safeAppt = CreateObject("Redemption.S
Set Appt = OlApp.CreateItem(olAppoint
safeAppt.Item = Appt
With safeAppt
.Subject = strSubject
.Start = dtStartTime
.End = dtEndTime
.AllDayEvent = bolAllDay
.Body = strBody
If Len(strAttendees) > 0 Then
.RequiredAttendees = strAttendees
.MeetingStatus = olMeeting
End If
.Importance = olImportanceHigh
.ReminderSet = True
.ReminderMinutesBeforeStar
If Len(strAttendees) > 0 Then
.Send
Else
.Save
End If
End With
Set Appt = Nothing
Set safeAppt = Nothing
Set OlApp = Nothing
Errexit:
If Err <> 0 Then
Debug.Print Err, Err.Description
Stop
End If
End Function
ASKER
I have tried using the send and receive button and nothing happens, I think Outlook thinks this has already been sent.
This is part of an application that will be adding calendar items and meeting without user involvement, so I need it to work without the pop-ups.
I've tried this in an exchange environment and have the same problems.
I've seen several posts indicating the redemption is the way to go, so I must be doing something wrong, I just don't see the problem.
This is part of an application that will be adding calendar items and meeting without user involvement, so I need it to work without the pop-ups.
I've tried this in an exchange environment and have the same problems.
I've seen several posts indicating the redemption is the way to go, so I must be doing something wrong, I just don't see the problem.
What version of Outlook are you using?
ASKER
Outlook version is 2003 sr1
Access version is 2003 sr1, but I've also tried 2000 sr3
Access version is 2003 sr1, but I've also tried 2000 sr3
ASKER
scarlet7,
I tried your code, it brings up a security pop-up.
When you schedule the appt as a meeting it automatically sends the inventation and this will cause the security warning to pop-up.
I actually think this worked last week, but I'm not positive, and i have not idea what could have changed.
Still need a solution though.
I tried your code, it brings up a security pop-up.
When you schedule the appt as a meeting it automatically sends the inventation and this will cause the security warning to pop-up.
I actually think this worked last week, but I'm not positive, and i have not idea what could have changed.
Still need a solution though.
I'll test it out more and see if I can suggest something tomorrow.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I take that back. It works for me in some cases but not in others. It may work for you or not. Still fiddling...
ThanX for the points Ajaac!
God bless!
Sam
God bless!
Sam
ASKER
Sorry it took so long to get back to you.
I've been tied-up with other projects.
My code was missing the ResolveAll method and this seems to have fixed the problem.
Thanks again for you help
Allen
I've been tied-up with other projects.
My code was missing the ResolveAll method and this seems to have fixed the problem.
Thanks again for you help
Allen
'*************************
Public Function CreateAppointment(strSubje
On Error GoTo Errexit
Dim OlApp As New Outlook.Application, Appt As Object, safeAppt As Object
Set OlApp = CreateObject("Outlook.Appl
Set Appt = OlApp.Session.GetDefaultFo
Set safeAppt = CreateObject("Redemption.S
Set Appt = OlApp.CreateItem(olAppoint
With Appt
.Subject = strSubject
.Start = dtStartTime
.End = dtEndTime
.AllDayEvent = bolAllDay
.Body = strBody
If Len(strAttendees) > 0 Then
.RequiredAttendees = strAttendees
.MeetingStatus = olMeeting
End If
.Importance = olImportanceHigh
.ReminderSet = True
.ReminderMinutesBeforeStar
.Save
End With
If Len(strAttendees) > 0 Then
safeAppt.Item = Appt
safeAppt.Item.Send
Else
Set Appt = Nothing
Set safeAppt = Nothing
Set OlApp = Nothing
Errexit:
If Err <> 0 Then
Debug.Print Err, Err.Description
Stop
End If
End Function
'*************************
I'm not sure if it will fix teh problem, but it is wort a shot. (I've never had a time when a redemption item went to the sent items folder without actually sending)
Just so you know with most Outlook item properties you will not hit the security walls when writing to them, and I personally find them friendlier to work wit then the SafeItem properties, which I just use for sending.
God bless!
Sam