Perl outlook calendar

T

timgerr

Not sure if anyone has used perl and outlook scripts but here I go.
OK I have found a little information on Perl and Outlook calendars. I
have a few questions that I want to ask. If I have myltiple calendars
in Outlook can I tell the OLE to use different ones? I have 2
calendars, test1 (default) and test 2. I want to query both calenders,
can this be done? The other question is I am trying to get all the
output in the hash ( I think it is a hash) $message. When the part
runs print "Start = " . $message->{Start}."\n";
I get this output Start = Win32::OLE::Variant=SCALAR(0x182a9b8).
How can I find out what is in this scalar? Any information would be
great.

Here is my code:

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Outlook';

my $outlook = Win32::OLE->new('Outlook.Application') or die
"Error!\n";

my $namespace = $outlook->GetNamespace("MAPI");
my $folder = $namespace->GetDefaultFolder(olFolderCalendar);
my $items = $folder->Items;

for my $itemIndex (1..$items->Count)
{
my $message = $items->item($itemIndex);
next if not defined $message;

print "subject = " . $message->{Subject}."\n";
print "Start = " . $message->{Start}."\n";
 
S

Sue Mosher [MVP-Outlook]

Namespace.GetDefaultFolder can only return your default Calendar folder. If you want any other folder, you can get it from the Folders hierarchy -- each MAPIFolder object having a Folders collection. You can start either at Namespace.Folders collection or with the Folders collection of your default Calendar, whichever is appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top