Wednesday, July 28, 2004

Add creator to shared calender entry event sink

  One of the big pains i find when your using a shared calendar in a public folder is that you can't easily tell which user has created each of the calendar entries. I came up with the following sink for a small project I'm working on that will append the name of the creator to the location field of an appointment or meeting request when its created (this will mean it will appear in brackets when you look at the normal calendar view next to each appointment). You can grab the creator of a item from the "" mapi property. 

Sub ExStoreEvents_OnSave(pEventInfo, bstrURLItem, lFlags)
on error resume next
Const EVT_NEW_ITEM = 1

If (lFlags And EVT_IS_DELIVERED) Or (lFlags And EVT_NEW_ITEM) Then 
set apptobj = CreateObject("CDO.Appointment") bstrURLItem,,3
creator = " Created by " & apptobj.fields("").Value
apptobj.fields("urn:schemas:calendar:location") = apptobj.fields("urn:schemas:calendar:location") & creator
end if
set apptobj = nothing

End Sub