0
votes

I am using Matlab to retrieve calendar appointments from a group of shared Outlook calendars. I need to include both recurring and non-recurring appointments within a certain date range. This code is working:

    outlook = actxserver('Outlook.Application');
    mapi = outlook.GetNamespace('mapi');
    explorer = mapi.GetDefaultFolder(9).GetExplorer;
    NavModule = explorer.NavigationPane.Modules.GetNavigationModule(1);
    NavGroup = NavModule.NavigationGroups.GetDefaultNavigationGroup(2);

    filter = {['[Start] >= ''',strDATstart,''' AND [Start] <= ''', strDATend, '''']};

    for i=1:NavGroup.NavigationFolders.Count
        NavFolder = NavGroup.NavigationFolders.Item(i);
        LST = NavFolder.Folder.Items;
        LST.IncludeRecurrences = -1;
        LST.Sort('[Start]');
        LST.Restrict(filter{1});
        etc.

I expected the Restrict method to remove Items from the list that were outside the date range set by the filter (strDATstart and strDATend are set elsewhere in the code). However, the Restrict method is not working as expect, and LST returns 2147483647 Items (I don't think this is legitimate, but rather represents some sort of overflow condition). Most of the Items returned are empty, but the overall size of the list is making my code prohibitively slow.

I'd appreciate any guidance on how to better retrieve or filter these appointments within a date range.

1
No, sure it is not the size of the list. That is -1 in hexa 7FFFFFFFCarlos E. Ferro

1 Answers

0
votes

Items.Restrict is a function that returns the new (restricted) collection. You need to use the returned object.