none
How to link a project task.UniqueID to an outlook.globalappointmentID? RRS feed

  • Question

  • Hi,

    I have a macro to export my project task to appointment in Outlook, but I would like to link both ID (in a table in the background where every time I export a task, it stores an appointmentID?) as they are readonly properties.

    The goal would be that if I move move for example the date in Outlook calendar, I could update the project start date or any other properties.

    Below is my macro

    Sub TaskToOutlook()
    Dim obJ0L As Object
    Set obJ0L = CreateObject("Outlook.Application")
    Set obJ0L = New Outlook.Application
    Dim ONS As Outlook.NameSpace
    Set ONS = obJ0L.GetNamespace("MAPI")
    Dim CAL_FOL As Outlook.Folder
    Set CAL_FOL = ONS.GetDefaultFolder(olFolderCalendar)
    Dim myapt As Outlook.AppointmentItem
    Dim ProjTask As Task
    If ActiveSelection = 0 Then
    MsgBox "Please select tasks you want to send to Outlook"
    Exit Sub
    End If
    For Each ProjTask In ActiveSelection.Tasks 'How to Avoid summary tasks?
                If CheckAppointmentExists(ProjTask.Start, ProjTask.Name) = True Then
                  Else
                   Set myapt = CAL_FOL.Items.Add(olAppointmentItem)
                       With myapt
                               .Start = ProjTask.Start
                               .End = ProjTask.Finish
                               .Subject = ProjTask.Name
                           .Save
                       End With
                       ' Link ProjTask.UniqueID to myapt.GlobalAppointmentID
                End If
        Next ProjTask
    End Sub

    Saturday, September 22, 2018 4:42 PM