使用 Perl 搜索 Lotus Notes 收件箱
我试图通过我的收件箱进行搜索以查找特定的电子邮件,但每次我尝试运行此脚本时,$search 都未初始化/未定义。语法有问题吗?
use Win32::OLE;
use Win32::OLE::TypeInfo;
#Create a new NotesSession, which is basically like a new Lotus Notes instance
my $Notes = Win32::OLE->new('Notes.NotesSession') or die "Could not open Lotus Notes";
#Prints the current user of Lotus Notes
print "The current user is $Notes->{UserName}.\n";
#Gets the stuff in the listed Database
my $Database = $Notes->GetDatabase('Server', 'mail.nsf');
# Open the mail
$Database->OpenMail;
# Create a new Document, ie email
my $Document = $Database->CreateDocument;
# Send the email to someone
$Document->{SendTo} = ;
# CC the email to someone
$Document->{SendCc} = ;
# Subject of the email
$Document->{Subject} = 'Test';
my $date = $Notes->CreateDateTime("Today");
my $today = $date->DateOnly;
my $search = $Database->Search("@Tripwire",$today,5);
print $search->Count;
谢谢
I'm trying to search through my inbox to find specific email's but there every time I try and run this script $search is uninitialized/undefined. Is there a problem with the syntax?
use Win32::OLE;
use Win32::OLE::TypeInfo;
#Create a new NotesSession, which is basically like a new Lotus Notes instance
my $Notes = Win32::OLE->new('Notes.NotesSession') or die "Could not open Lotus Notes";
#Prints the current user of Lotus Notes
print "The current user is $Notes->{UserName}.\n";
#Gets the stuff in the listed Database
my $Database = $Notes->GetDatabase('Server', 'mail.nsf');
# Open the mail
$Database->OpenMail;
# Create a new Document, ie email
my $Document = $Database->CreateDocument;
# Send the email to someone
$Document->{SendTo} = ;
# CC the email to someone
$Document->{SendCc} = ;
# Subject of the email
$Document->{Subject} = 'Test';
my $date = $Notes->CreateDateTime("Today");
my $today = $date->DateOnly;
my $search = $Database->Search("@Tripwire",$today,5);
print $search->Count;
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“@Tripwire”应该是: 定义选择标准的 Notes @function 公式。这意味着它需要是与视图选择公式中类似的字符串。就像 Sendto="@TripWire"
"@Tripwire" should be: A Notes @function formula that defines the selection criteria. This means that it needs to be a similar string as in a view selection formula. Like Sendto="@TripWire"
或者您在数据库中启用全文搜索并使用 FtSearch 而不是搜索。
Or you enable full-text searching in your database and use FtSearch instead of Search.
我不是 Perl 程序员,但相信您还有其他问题。通过 COM 接口设置或访问 NotesItem 值时不支持“扩展语法”表示法。即,您对 $Document->{SendTo}、$Document->{SendCc} 和 $Document->{Subject} 的引用不正确。您应该使用 $Document->ReplaceItemValue 并提供项目名称和值作为参数。此外,SendCC 不是正确的项目名称。它应该是复制到。
I'm not a Perl programmer, but believe you have additional problems. The "extended syntax" notation is not supported for setting or accessing NotesItem values via the COM interface. I.e., your references to $Document->{SendTo}, $Document->{SendCc}, and $Document->{Subject} are incorrect. You should use $Document->ReplaceItemValue and provide the item name and value as arguments. Also, SendCC is not the correct item name. it should be CopyTo.