I am using Perl in Linux Environment. want to fetch MS Exchange attributes (like mAPIRecipient) Using Net::LDAPS, but it only gives me access t开发者_开发问答o LDAP attributes (not Exchange attr.) In Windows it seems possible with Win32::OLE How can we do it in perl ?
I don't see why Net::LDAP
would not give you all the attributes, included the Active Directory ones, as it does not discern between LDAP and AD/MS Exchange attributes.
Just ran this code in one of our Linux servers:
use v5.10;
use Net::LDAP;
my $filter = '(&(objectCategory=user))';
my $base = 'dc=example,dc=com';
my $ldap = Net::LDAP->new( $host ) or die $!;
my $ldap->bind('myuser', password=>'s3cr3t' );
my $results = $ldap->search(
base => $base,
scope =>'sub',
filter =>$filter
);
# to detect bind/search errors:
die $results->error if $results->code;
my $entry = $results->entry(0);
say for sort $entry->attributes;
These are the attributes I got from our AD. I don't see mAPIRecipient
, maybe because it's not configured to come out, not sure, but I get a lot of other MS Exchange specifics:
accountExpires
adminCount
badPasswordTime
badPwdCount
cn
codePage
countryCode
description
displayName
distinguishedName
givenName
instanceType
ipPhone
isCriticalSystemObject
lastLogonTimestamp
lockoutTime
mSMQDigests
mSMQSignCertificates
memberOf
msExchALObjectVersion
msExchUserAccountControl
msNPAllowDialin
name
objectCategory
objectClass
objectGUID
objectSid
primaryGroupID
pwdLastSet
sAMAccountName
sAMAccountType
uSNChanged
uSNCreated
userAccountControl
userParameters
userPrincipalName
whenChanged
whenCreated
精彩评论