【问题标题】:Searching Lotus notes inbox with Perl使用 Perl 搜索 Lotus notes 收件箱
【发布时间】:2011-09-22 04:44:11
【问题描述】:

我正在尝试搜索我的收件箱以查找特定的电子邮件,但每次我尝试运行此脚本时 $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;

谢谢

【问题讨论】:

    标签: perl lotus-notes


    【解决方案1】:

    "@Tripwire" 应该是:定义选择标准的 Notes @function 公式。这意味着它需要是与视图选择公式中类似的字符串。喜欢 Sendto="@TripWire"

    【讨论】:

    • 语法是什么?我试过 $Database->Search(Subject = "@Tripwire",$today,5);但我得到一个错误。我应该使用变体吗?
    • 在 Lotusscript 中我会使用 |Sendto= "@Tripwire"|作为语法
    • 即使您使用 Perl,搜索查询也必须以 Notes/Domino 理解的语法编写。有关语法的更多帮助,请查看 Notes Designer Help,章节“使用运算符优化搜索查询”www-12.lotus.com/ldd/doc/domino_notes/6.5.1/help65_client.nsf/… 或 domino.mpi-inf.mpg.de/icons/help.htm 对于上面的示例,必须是 [Subject] CONTAINS "@Tripwire"
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

      我不是 Perl 程序员,但相信您还有其他问题。不支持通过 COM 接口设置或访问 NotesItem 值的“扩展语法”表示法。即,您对 $Document->{SendTo}、$Document->{SendCc} 和 $Document->{Subject} 的引用不正确。您应该使用 $Document->ReplaceItemValue 并提供项目名称和值作为参数。此外,SendCC 不是正确的项目名称。应该是 CopyTo。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-06-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多