MS Outlook provides MAPI to access outlook calendar items. With calendar items it can find all recurring and non-recurring appointments of outlook. In case of recurring appointments all occurrences of recurring appointments can be found using GetOccurence function of RecurrencePattern of AppointmentItem. GetOccurence function will take the date and time to return the occurrence on that date. If occurence exists, it will return otherwise it will give exception.
If all the occurences of a recurring appointment have same StartTime and EndTime then providing starttime input to GetOccurence, works perfectly fine. But if one particular occurence StartTime and EndTime is modified then GetOccurence will not return that occurrence. The other way could be to check occurence for every 30 minute interval on the every day. But this approach seems not to be an efficient.
Anyone have better idea to do this?
_ApplicationPtr olApp("Outlook.Application");
_NameSpacePtr olMAPI;
olMAPI = olApp->GetNamespace("MAPI");
hr = olMAPI->Logon("","",false,false);
MAPIFolderPtr olCalendarFolder = olMAPI->GetDefaultFolder(olFolderCalendar);
_ItemsPtr olCalendarItems = olCalendarFolder->GetItems();
_AppointmentItemPtr olAppt = (_AppointmentItemPtr) olCalendarItems->GetFirst();
RecurrencePatternPtr recurPattern = olAppt->GetRecurrencePattern();
_AppointmentItemPtr _olAppt = recurPattern->GetOccurrence(recurPattern->GetPatternStartDate()+recurPattern->GetStartTime());