使用 Perl 搜索 Lotus Notes 收件箱

发布于 2024-11-28 00:45:01 字数 966 浏览 4 评论 0原文

我试图通过我的收件箱进行搜索以查找特定的电子邮件,但每次我尝试运行此脚本时,$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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

莫相离 2024-12-05 00:45:01

“@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"

春夜浅 2024-12-05 00:45:01

或者您在数据库中启用全文搜索并使用 FtSearch 而不是搜索。

Or you enable full-text searching in your database and use FtSearch instead of Search.

风月客 2024-12-05 00:45:01

我不是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文