ADSI, SQL, Exchange Server 2010

Posted by WernerCD on Programmers See other posts from Programmers or by WernerCD
Published on 2012-10-19T14:20:15Z Indexed on 2012/10/19 17:17 UTC
Read the original article Hit count: 377

Filed under:
|
|

Maybe I'm barking up the wrong tree...

We have a Domain Controller "DC1". We have Exchange Server 2010 "Postman".

Say I have an Address Book: enter image description here

And I add a few contacts to it: enter image description here

How then do I get the data from that contact via ADSI? Say I want the Job Title or CustomerID field that I filled out in the Contacts list?

    SELECT * FROM OPENQUERY(ADSI,
    'SELECT
         EXTENSIONATTRIBUTE15
        ,DISPLAYNAME
        ,GIVENNAME 
        ,NAME
        ,SN
        ,SAMACCOUNTNAME
    FROM ''LDAP://DC=ATLANTICGENERAL,DC=ORG''
    WHERE USERACCOUNTCONTROL=512
      AND SAMACCOUNTTYPE=805306368
      AND OBJECTCLASS=''PERSON''
      AND OBJECTCLASS=''USER''
    ORDER BY
         SAMACCOUNTTYPE
    ')

How can I tie the Contact Card to an Active Directory User, so that I can edit either the AD account information OR the Exchange information and have them synced up?

© Programmers or respective owner

Related posts about active-directory

Related posts about exchange