Yes... there are two approaches though. You can either do it interactively
or non-interactively. 

your mail suggests you have an interactive user who will run a script.  If
outlook is open you can just use an existing session, otherwise you have to
use the MAPI.Logon method which is supplied by CDO.DLL, CDONTS.DLL or
CDOSYS.DLL depending what OS you have. WinNT pretends its supplied by
OLEMSG32.dll but it lies. 

Ok - the addressbook. Assuming defaults you can use an "anonymous profile"
which means you only need the server name. Alternatively grab the users
username and pick an exchange server... 

These constants might be useful to you - they should both give an SMTP
address (&H is VB for hex format - just change them): 
Const g_PR_SMTP_ADDRESS_W = &H39FE001F
Const g_PR2 = &H39FE001F

----
my $session = Win32::OLE->new("MAPI.Session") or die;
my $connect = "$server" . chr(10) . "$username";
$session->Logon(,,0 ,,,, $connect); 

That answers your immediate question. To pop up the Global Address List the
session object has an AddressBook method, or you can just query the message
store. Alternatively, have you thought of using LDAP/ADO against the
exchange directory rather than MAPI - that seems more intuitive at first
glance?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_o
lemsg_session_object.asp (browse to the Logon method for a description of
profiles etc)

Kind regards,

Mark Anderson
Service Improvement Programme
Level 2, 113 Dundas Street
Edinburgh, EH3 5DE
Tel: 0131 523 8786
Mob: 07808 826 063


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED] On Behalf Of
> steve silvers
> Sent: Monday, April 18, 2005 9:12 PM
> To:   perl-win32-users@listserv.ActiveState.com
> Subject:      Perl and MAPI
> 
> *** WARNING : This message originates from the Internet ***
> 
> Does anyone know how I can use perl to specify an outlook profile, and
> query 
> the address book. Get a list of all names.
> 
> Thanks in advance
> Steve
> 
> 
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial 
Services Authority and represents The Royal Bank of Scotland Marketing Group. 
The Bank sells life policies, collective investment schemes and pension 
products and advises only on the Marketing Group's range of these products and 
on a With-Profit Bond produced by Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The Royal Bank of 
Scotland plc does not accept responsibility for changes made to this message 
after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, 
it is the responsibility of the recipient to ensure that the onward 
transmission, opening or use of this message and any attachments will not 
adversely affect its systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry out 
such virus and other checks as it considers appropriate.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to