I have this vba code that you will need to adapt.
It creates and updates (but does not delete) appointments in my calendar for
tasks that I am assigned to as a resource.
This code uses the Outlook Mileage field to store the Task Unique ID.
Good luck Sorry about the word wrapping in this reply. Try cut and paste
from here.
Sub Update_Outlook_Calander()
' Opens Maurices Outlook Calendar and updates or creates (but not deletes)
' any appointments with Location = ProjectName
'If project is empty, alert the user and end the macro
ProjectName = ActiveProject.Name
If ActiveProject.Tasks.Count > 0 Then
Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI")
Set currFolder = olMAPI.Folders("Mailbox -
Maurice").Folders("Calendar")
For I = 1 To ActiveProject.Tasks.Count
CurrTaskResourceCount = ActiveProject.Tasks(I).Resources.Count
If ActiveProject.Tasks(I).ResourceNames Like "*Maurice*" Then
CurrTask = ActiveProject.Tasks(I)
CurrTaskID = ActiveProject.Tasks(I).UniqueID
CurrTaskNum = ActiveProject.Tasks(I).ID
CurrTaskResourceNames = ActiveProject.Tasks(I).ResourceNames
CurrTaskName = ActiveProject.Tasks(I).Name
' update with actual Start/Finish if task has these.
CurrTaskStart = ActiveProject.Tasks(I).ActualStart
CurrTaskFinish = ActiveProject.Tasks(I).ActualFinish
If CurrTaskStart = "NA" Then CurrTaskStart =
ActiveProject.Tasks(I).Start
If CurrTaskFinish = "NA" Then CurrTaskFinish =
ActiveProject.Tasks(I).Finish
'Call MsgBox(CurrTaskNum)
SearchStr = "[Location] = " & VBA.Chr$(34) & ProjectName &
VBA.Chr$(34) & _
" AND [Mileage] = " & VBA.Chr$(34) & CurrTaskID &
VBA.Chr$(34)
Set myAppointments = currFolder.Items
Set CurrAppointment = myAppointments.Find(SearchStr)
If TypeName(CurrAppointment) <> "Nothing" Then
'update this appointment
'Call MsgBox(CurrAppointment.Mileage)
CurrAppointment.Start = CurrTaskStart
CurrAppointment.End = CurrTaskFinish
'CurrAppointment.Mileage = CurrTaskID
'CurrAppointment.Location = ProjectName
CurrAppointment.Subject = CurrTaskName & " :" & CurrTaskID
CurrAppointment.Body = CurrTaskNum & vbCrLf &
CurrTaskResourceNames & vbCrLf & ActiveProject.Tasks(I).Notes
'CurrAppointment.ReminderSet = True
CurrAppointment.Save
' Are there splits from Palm Synch that need to deleted?
While TypeName(CurrAppointment) <> "Nothing"
Set CurrAppointment = myAppointments.FindNext
If TypeName(CurrAppointment) <> "Nothing" Then
CurrAppointment.Delete
Wend
Else
'create new appointment
Set CurrAppointment = myAppointments.Add
CurrAppointment.Start = CurrTaskStart
CurrAppointment.End = CurrTaskFinish
CurrAppointment.Mileage = CurrTaskID
CurrAppointment.Location = ProjectName
CurrAppointment.Subject = CurrTaskName & " :" & CurrTaskID
CurrAppointment.Body = CuurTaskNum & vbCrLf &
CurrTaskResourceNames & vbCrLf & ActiveProject.Tasks(I).Notes
CurrAppointment.ReminderSet = False
CurrAppointment.Save
End If
End If
Next I
End If
End Sub