Wednesday, June 2, 2010

MS Outlook COM : Retrieve Recurring Appointment Data

'Script to retrieve recurring item from appointment list
'VBA, would run the script editor along with outlook
'Changes to be done if need to run outside outlook in a vbscript
'Reference : http://msdn.microsoft.com/en-us/library/bb219954.aspx

**************************************************************************

Public Sub Application_GetItem()
Set nms = Application.GetNamespace("MAPI")
Set fld = nms.GetDefaultFolder(9)
Set itms = fld.Items
lngCount = itms.Count
i = 0
For Each itm In itms
If itm.IsRecurring Then
i = i + 1
itm.Display
itm.ClearRecurrencePattern
itm.Close (olDiscard)
End If
Next
End Sub

No comments: