Hi Ken,
Thanks for the quick reply. I am using the GetOccurrence Method from
the RecurrencePattern to obtain a Occurrence. But when I try to modify
any value of this Occurrence(like I am updating StartDate of the
Appointment), the control goes out of the project and the
application(project) closes down.
The code snippet is as follows:
_AppointmentItem parentObj;
LPDISPATCH lpParent = m_NamespaceObj.GetItemFromID(csGUID,(const
struct tagVARIANT)Temp);
if(lpParent)
parentObj.AttachDispatch(lpParent);
if(parentObj.m_lpDispatch){
RecurrencePattern recPatternObj;
LPDISPATCH lpRecurObj = parentObj.GetRecurrencePattern();
if(lpRecurObj)
recPatternObj.AttachDispatch(lpRecurObj);
if(recPatternObj.m_lpDispatch){
COleDateTime dtDate;
if(!csStartDate.IsEmpty())
dtDate.ParseDateTime(csStartDate);
if(dtDate.m_dt)
lpActivityDisp = recPatternObj.GetOccurrence(dtDate.m_dt);
recPatternObj.ReleaseDispatch();
}
parentObj.ReleaseDispatch();
}
The lpActivityDisp gives me the Correct Occurrence as per the Date
Specified.
But when I try the below code, it gives error. I am also unable to get
the error message too. It just closes the application and comes out.
_AppointmentItem aptItem;
aptItem.AttachDispatch(lpActivityDisp);
COleDateTime oleLocalTime;
oleLocalTime.SetDateTime(oleStartDate.GetYear(),
oleStartDate.GetMonth(), oleStartDate.GetDay(),
oleStartDate.GetHour(), oleStartDate.GetMinute(),
oleStartDate.GetSecond()); // oleStartDate contains the Date, which
we need to set the Start Date by.
AppmtItem.SetStart(oleLocalTime);
..
..
..
Please suggest, whether I am doing something wrong in Initiating the
Occurrence?
Thanks,
Maya