Outlook + Perl + Win32 :: Ole:如何选择按日期排序的日历项? [英] Outlook + Perl + Win32::Ole: How do you select calendar entries sorted by date?

查看:70
本文介绍了Outlook + Perl + Win32 :: Ole:如何选择按日期排序的日历项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前代码按如下所示打开Outlook日历数据库:

Current code opens up an Outlook Calendar database as follow:

my $outlook = Win32::OLE->GetActiveObject('Outlook.Application') || Win32::OLE->new('Outlook.Application', 'Quit');

my $namespace = $outlook->GetNamespace("MAPI");

## only fetch entries from Jan 1, 2007 onwards
my $restrictDates = "[Start] >= '01/01/2007'";  

推荐答案

由于您没有显示获取对象日期的代码,因此如果不了解您要尝试的Outlook对象,就无法回答此问题.访问.

Since you don't show the code that gets the date of your object, this question is impossible to answer without some knowledge of the Outlook object you are trying to access.

如果您有一组对象,则可以按日期对它们进行排序,并在某个对象之前对它们进行过滤.

If you have an array of objects you can sort them by date and filter ones prior to a certain one.

my $sub = sub {
       my $ad = $a->date_string_accessor;
       my $bd = $b->date_string_accessor;
       $ad =~ s:(\d+)/(\d+)/(\d+):$3 . sprintf('%0d', $1) . sprintf('%0d', $2):e;
       $bd =~ s:(\d+)/(\d+)/(\d+):$3 . sprintf('%0d', $1) . sprintf('%0d', $2):e;
       return $ad cmp $bd;
};

my @sorted = sort $sub @unsorted;

print join("\n", @sorted);

但是在我看来,您应该使用应用程序本身来执行此操作-大概Outlook具有某种查询/排序功能.

But it would seem to me that you should use the application itself to do this -- presumably Outlook has some sort of query/sort functionality.

这篇关于Outlook + Perl + Win32 :: Ole:如何选择按日期排序的日历项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆