Results 1 to 2 of 2

Thread: Query Active directory

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    6

    Query Active directory

    I have a Microsoft Access Application which I'm currently working on.

    We're running on a domain and I need to find the email address of the currently logged in user from Active Directory.

    When using Outlook WebAccess, if I type in a member of staff's login name, eg. LFD then press "Check Names" it corrects it with their full name and email address.

    Therefore I'm pretty sure the Domain Login and Email Address Associated with that person's login are held in the same place.

    I need to be able to query this active directory, passing in the currently logged in username and have it return their email address.

    Code:
    LoggedInUser=(Environ("Username"))
    is sufficient, as staff do not have access to cmd or anything that would enable the changing of this environment variable. - Plus security isn't a huge priority with the system.

    I'm presuming I would need to setup a custom function to do this
    I'm most happy with performing this within VBA
    However I have access to VB 6, which I can build an external function, should I have to.

    Please help me, as I'm struggling to find a way to do this, and it's the most essential part of my project.

    any help or directions to another site are all greatfully received.


    Dan Walters
    danielwalters6 at hotmail dot com


    Little Bit More Background Info:
    With this email address, I have tried and tested a way for Access to communicate directly with the network's smtp server, and a specified email address an email confirming them of their actions whilst in the system.
    I need to pass in the email address of the currently logged in user, to get my project working as I would like.

  2. #2
    Fanatic Member drivenbywhat's Avatar
    Join Date
    Jan 2007
    Location
    VA - USA
    Posts
    866

    Re: Query Active directory

    Two broad things that may help you are VBSCRIPT & ADSI. You can use both to query & even modify objects in active directory. Unfortunately, I don't have a specific code for you. I've used them to create users and delete them as well with as little as 10 lines of code. All that is needed is the "path" of the object you are inquiring about. So for example, active directory is in a domain named fakedomain.com. It is also on a server pc called server01. The user is in an organizational unit (ou) called myou. You would make references to these in a path like "fso = ou=myou, server01, dc=fakedomain, dc=com". Something like that. It's been a while since I've done it. But anyways, once you are able to set the path to the object you want, then you just query the property of that object for what you're looking for. Again, you'll have to find how to do this by researching vbscript or adsi.
    [vb5 & starting to move to vb2008] I appreciate the help I get from everyone. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width