Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I haven't done exactly what you're looking for, but I do a lot of stuff with Active Directory by using Net::LDAP and Win32::OLE. Net::LDAP is probably a bit easier to use, whilst Win32::OLE allows you to do some stuff without authenticating (allowing pass through, if you will).

An excellent resource for this type of stuff is the book "Managing Enterprise Active Directory Services" by Robbie Allan and Rickard Puckett, which contains examples of anything that you'd want to do in both VB and Perl.

I haven't creatd contact objects, only user ones, but I think that what I've suplied you with below should work.

use strict; use Net::LDAP; use Net::LDAP::Entry; my $ldap_prov = *servername* print ("\nUsername for connection: "); my $username = <STDIN>; print ("\nPassword: "); my $password = <STDIN>; chomp $username; chomp $password; my $ldap = Net::LDAP->new($ldap_prov) || die; my $bind = $ldap->bind($user, password => $password, $version => 3); my $contact = Net::LDAP::Entry->new(); $contact->dn("cn=$contact,cn=contacts,dc=aaa,dc=com); $contact->add(objectclass -> 'contact'); # I'm not sure if you'll need + to pass anything else here. Normally when you setup a user, you'll +need to also pass the SAMAccountName attribute.... my $result = $contact->update($ldap); $ldap->unbind;
This (should) create the contact, although it may take some fiddling to get spot on. I've only ever used it to create users, but theoretically speaking it should be fine for contacts. Let me know how you go with it if you choose to try and code it.

Obviously before you unbind and after you update, you could add any further fields that you want to, or you could just add more attributes during the initial create.


In reply to Re: Adding a list of contacts to Exchange Address book. by SquireJames
in thread Adding a list of contacts to Exchange Address book. by thunders

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found