Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Retrieiving User Properties from Outlook via OLE

by JojoLinkyBob (Scribe)
on Feb 28, 2001 at 03:02 UTC ( [id://61224]=perlquestion: print w/replies, xml ) Need Help??

JojoLinkyBob has asked for the wisdom of the Perl Monks concerning the following question:

Edited by mirod: added code tags

Desert coder

Hello Council of Wisdom, today's challenge is as follows:

I've got a script that uses Outlook to resolve User ID's. Each employee at our company has such an ID (e.g. e630485), that when resolved in Outlook returns the full name (i.e. "Smith, John"), was wondering if there's an easy way through OLE to grab the equivalent of Right-Click, Properties on such a name. Thanks in advance!
my $Outlook = Win32::OLE->GetActiveObject( $Class ); if ( ! $Outlook ) { printf "Please open Outlook and try again!\n"; exit(0); } my $email = $Outlook->CreateItem(0); my $rcpt = $email->Recipients->Add($ARGV[0]); $rcpt->Resolve(); my $testname = $rcpt->Name(); print "$testname\n";

Replies are listed 'Best First'.
Re: Retrieiving User Properties from Outlook via OLE
by Corion (Patriarch) on Feb 28, 2001 at 13:16 UTC

    First of all, you might want to read the Site How To, especially on how to format writeups.

    If you're using Win32::OLE, you need documentation on your counterpart, in this case, documentation for the Outlook (97 or 2000) object model. This documentation is available from Microsoft, either through your MSDN subscription or even online (, but here are some pointers, which I will update when I get home to my working Outlook-Phone-Number-Extractor (used for reverse lookup of known telephone numbers) :

    my $App = Win32::OLE->GetActiveObject( "Outlook.Application" ); die "No Outlook\n" unless defined $App; my $OE = $App->Explorer(); ... To be filled in when I'm at home ...

    Thinking some more about this, what you really want to talk to is not Outlook, but the Address Book (also somewhat related to Outlook, but not completely so). If you're doing some stuff with some contact items (like, 300+ items), the Outlook object model becomes unwieldly and slow, then you will have to dump Perl and use a language that lets you use real MAPI (an API that is just a fancy object oriented interface to a database, soon to be faded out by Microsoft, but it works and works relatively well).

    Update 1 (A reply to seekers node below, not really warranting its own node, as it's offtopic IMO): LDAP is only available with Exchange Server 5.5 (or higher), Outlook itself has no capabilities for offering LDAP support. Outlook can function as a (limited) LDAP client, as can Netscape, but not as a server.

    Update 2 I posted a snippet to the Code Catacombs which dumps all phone numbers of all contacts (used to do a reverse lookup).

      Along those lines, I wonder if you can use LDAP to get to some of that information in IE. I heard that Netscape was going to support LDAP, and I was just wondering.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://61224]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 08:54 GMT
Find Nodes?
    Voting Booth?

    No recent polls found