2011-08-05 9 views
1

メールを検索して特定のメールを検索しようとしていますが、このスクリプトを実行しようとするたびに$ searchは未初期化/未定義です。構文に問題はありますか?PerlでLotus Notes受信トレイを検索する

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; 

おかげ

答えて

4

"@Tripwire" がなければならない:選択基準を定義ノーツ@関数式。これは、ビュー選択式の場合と同様の文字列である必要があることを意味します。 Sendto = "@ TripWire"

+0

構文は何ですか?私は$ Database-> Search(Subject = "@Tripwire"、$ today、5)を試みました。しかし、私はエラーが発生します。私はバリアントを使用すべきですか? – Shahab

+0

LotusScriptでは、私はSendto = "@Tripwire"を使用します。構文として –

+0

perlはどうですか? – Shahab

1

または、データベースでフルテキスト検索を有効にし、検索の代わりにFtSearchを使用します。

0

私はPerlのプログラマーではありませんが、追加の問題があると考えています。 COMインターフェイス経由でNotesItem値を設定またはアクセスする場合、「拡張構文」表記はサポートされていません。つまり、$ Document - > {SendTo}、$ Document - > {SendCc}、$ Document - > {Subject}への参照が間違っています。 $ Document-> ReplaceItemValueを使用し、項目名と値を引数として指定する必要があります。また、SendCCは正しい項目名ではありません。それはCopyToでなければなりません。

関連する問題