Sign in to follow this  
Followers 0
Avian

Build Phone Directory from Active Directory

4 posts in this topic

A while back, I worked at a large company that maintained the company phone directory via Active Directory. My personal PDA couldn't sync with AD, so I never had the phone numbers I needed. I eventually wrote this script to dig through AD and pull out the names, phone numbers, locations, managers, etc. from AD. I wrote it so it would either update Outlook or dump the data to a tab-delimited ASCII file.

The program as written may not totally suit your needs depending on how your IT folks have AD populated. There may be certain fields that your company uses that ours didn't use, and vice versa. I dug through MSDN until I found all the fields we had populated that provided the info I wanted. You may have to find and use other fields. YMMV.

The program retrieves AD records for AD ObjectCategory = Person and ObjectClass = User. In our case we had some OrganizationalUnits (OUs) that I didn't need and some EmployeeTypes (ETs) that I didn't want, either. You may specify OUs and ETs in the .ini file to be ignored when retrieving data. Another way I minimized the records I wanted was to suppress any record that didn't have a manager. A sample .ini file is attached as a .txt file.

When adding the records to Outlook, I set a specific category name so that all these records may be separated from other groups. This program does NOT perform an update - it deletes all the records in the specified category and reloads them from AD. I felt it was too time-consuming to try to determine which fields within a record had changed.

For trial purposes, I'd suggest dumping to an ASCII text file until you get the records you want.

Cheers,

Avian

MyCoDirectory.au3

MyCoDirectory.txt


A millihelen is the amount of beauty required to launch one ship.

Share this post


Link to post
Share on other sites



how to search number,name in dir.......................

Share this post


Link to post
Share on other sites

where is store data.............

or .ini how to use it...............& where

Share this post


Link to post
Share on other sites

where is store data.............

or .ini how to use it...............& where

Yashrai,

The source data is Microsoft's Active Directory. An LDAP directory MIGHT work, but I have not tested it with LDAP. If you're not logging into a Windows domain, you're probably not going to have AD, nor will you have the need for this program. I wrote it because I worked at a company with about 7000 employees and had no other way to get a company directory onto my non-company PDA (a Treo 680 at that point. It'd work with a Blackberry, as well, if you synced it through Outlook and not as part of a Blackberry Enterprise Server).

A sample .ini file was uploaded with the source code. The source code is also commented pretty well, so between the two, you should be able to figure it out. Put the .ini file in the same folder with the executable.

The program will write to either Outlook's Contacts folder or to an ASCII text file in the same folder as the executable.

If you don't have access to AD, then you'll not be able to test this program. I posted it as an example. I had to dig for a lot of the information I used to create this program and wanted to make it available to others that might want to do something similar.

Avian


A millihelen is the amount of beauty required to launch one ship.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0