purpleflash
February 17th, 2008, 05:10 PM
I'm writing a class to retrieve Outlook appointments. It must include recurring days.
With this code:
// Get the Inbox folder.
MAPIFolder oCal;
if (!local)
{
oCal = oNS.GetSharedDefaultFolder(rec, OlDefaultFolders.olFolderCalendar); // use anyone's profile
}
else
{
oCal = oNS.GetDefaultFolder(OlDefaultFolders.olFolderCalendar); // using only own profile
}
//Get the Items collection in the Appointment folder, filtered by the query.
Items oItems = oCal.Items;
oItems.IncludeRecurrences = true;
oItems = oCal.Items.Restrict(filter);
It works, IF the date of the 1st instance of the recurring appointment happens to be within the filter... but it does not work if the 1st instance is outside the filter parameters.
For instance, suppose I have this filter:
[Start]>=03/01/2008 and [End]<=03/15/2008
and there is a recurring appointment set up such as:
03/05/2008
03/10/2008
It will return both of these. However, if there are 3 instances like this:
02/26/2008
03/05/2008
03/10/2008
none are returned, because the [Start] is before 03/01/2008, EVEN THOUGH two of the appointment instances DO fall inside the filter criteria..
To me this makes no sense... it should return those appointment dates that fall between the start and end of the filter, even though there are some that are before the Start date and maybe some after the End date...
Any solutions, from those who have done this type out Outlook work?
thx.
With this code:
// Get the Inbox folder.
MAPIFolder oCal;
if (!local)
{
oCal = oNS.GetSharedDefaultFolder(rec, OlDefaultFolders.olFolderCalendar); // use anyone's profile
}
else
{
oCal = oNS.GetDefaultFolder(OlDefaultFolders.olFolderCalendar); // using only own profile
}
//Get the Items collection in the Appointment folder, filtered by the query.
Items oItems = oCal.Items;
oItems.IncludeRecurrences = true;
oItems = oCal.Items.Restrict(filter);
It works, IF the date of the 1st instance of the recurring appointment happens to be within the filter... but it does not work if the 1st instance is outside the filter parameters.
For instance, suppose I have this filter:
[Start]>=03/01/2008 and [End]<=03/15/2008
and there is a recurring appointment set up such as:
03/05/2008
03/10/2008
It will return both of these. However, if there are 3 instances like this:
02/26/2008
03/05/2008
03/10/2008
none are returned, because the [Start] is before 03/01/2008, EVEN THOUGH two of the appointment instances DO fall inside the filter criteria..
To me this makes no sense... it should return those appointment dates that fall between the start and end of the filter, even though there are some that are before the Start date and maybe some after the End date...
Any solutions, from those who have done this type out Outlook work?
thx.