Assigning Task's in Redemption

  • Thread starter Hanspeter Gysel
  • Start date
H

Hanspeter Gysel

I wrote a little VBA macro to create an assigned task for a selected
appointment. To get around the outlook security I tried to port it to
Redemption. At the moment I dont get any security dialogs anymore and the
task gets created correctly. The problem is with the assignement. I get no
errors, but the task is not assigned to the recipient. The recipient does
not get any email with assignements at all.
Se my code below:

------------------------------------------------------------------
Sub CreateAssignedTaskFromAppointment2()
' Creates an assined task from an open appointment

Dim objNewTask As Object
Dim rNewTask As Object
Dim objInspector As Outlook.Inspector
Dim objAppointmentItem As Object
Dim rAppointmentItem As Object
Dim strCalenderOwner As String
Dim Utils As Object

' get the active inspector
Set objInspector = Session.Application.ActiveInspector

' check if an inspector was active
If Not objInspector Is Nothing Then

' get the item viewd by the inspector
Set objAppointmentItem = objInspector.CurrentItem
Set rAppointmentItem = New Redemption.SafeAppointmentItem
rAppointmentItem.Item = objAppointmentItem

' check if the item is an appointment
If TypeName(rAppointmentItem) = "SafeAppointmentItem" Then

' create a new task
Set objNewTask = Session.Application.CreateItem(olTaskItem)
Set rNewTask = New Redemption.SafeTaskItem
rNewTask.Item = objNewTask

' first save the open appointment
rAppointmentItem.Save

With rNewTask
' copy propertys from the appointment to the new task
.Subject = rAppointmentItem.Subject
.DueDate = rAppointmentItem.Start
.Importance = rAppointmentItem.Importance
.ReminderTime = rAppointmentItem.Start
.Body = rAppointmentItem.Body
.Categories = rAppointmentItem.Categories

' save the new task
.Save

' assignt the task to the calender-owner
.Assign

' determine the owner of the calendar
' NOTE: this only works if the recipients mailbox is in the
creators folder-list
strCalenderOwner = CStr(rAppointmentItem.Parent.Parent.Name)
strCalenderOwner = Mid(strCalenderOwner,
InStr(strCalenderOwner, " - ") + 3)
.Recipients.Add (strCalenderOwner)

' send the assignement
.Send

End With
End If
End If

' clear all objects
Set objAppointmentItem = Nothing
Set objInspector = Nothing
Set objNewTask = Nothing
Set rAppointmentItem = Nothing
Set rNewTask = Nothing

' Cleanup Rendemption
Set Utils = CreateObject("Redemption.MAPIUtils")
Utils.Cleanup
End Sub
------------------------------------------------------------------

Any suggestions? Whats wrong with my code?

Thanks in advance
Hanspeter Gysel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top