Directory Programming .NET

Active Directory and ADAM programming support for .NET developers
Welcome to Directory Programming .NET Sign in | Join | Help
in Search

AD User attributes using AccountManagement

Last post 09-17-2008, 10:49 AM by joe. 7 replies.
Sort Posts: Previous Next
  •  08-26-2008, 2:42 AM 4501

    AD User attributes using AccountManagement

    I just want to ask how would I get a specific attribute of an Active Directory  user, such as the TITLE or MANAGER using the new System.DirectoryServices.AccountManagement. Thanks.

     

  •  08-26-2008, 8:12 AM 4502 in reply to 4501

    Re: AD User attributes using AccountManagement

    Quick and dirty way would be like this:

    ((DirectoryEntry)UserPrincipalObject.GetUnderlyingObject()).Properties["title"][0].ToString

     

    To do it right you should search around on how to extend the UserPrincipal class. 

  •  08-26-2008, 9:45 AM 4504 in reply to 4502

    Re: AD User attributes using AccountManagement

    Yep, that's exactly it.  :)

    There are a few strong examples of custom extensions to the various Principal classes buried in code samples in this forum that are worth checking out if something more than "quick and dirty" is desired.

    The key point in deciding whether to bother with this depends a great deal on how much code you will be writing that will consume your custom Principal objects and how easy you want to make it for them.

  •  09-17-2008, 12:59 AM 4763 in reply to 4504

    Re: AD User attributes using AccountManagement

    thanks rich, joe. It works.

  •  09-17-2008, 9:03 AM 4769 in reply to 4763

    Re: AD User attributes using AccountManagement

    To add on this further. Is there a way to create a custom search that would check to see if someone is a manager of an OU? I'm sure there is but I am so new to this I still have the new car smell.
    Web Developer
    Daxcon Engineering
  •  09-17-2008, 9:59 AM 4771 in reply to 4769

    Re: AD User attributes using AccountManagement

    Possibly, but the term "manager of an OU" doesn't have a definite meaning in AD.  Can you be more specific regarding what is meant by "manager of an OU"?  Is that a user with delegated permissions to do a specific thing to a specific OU or is that something else?
  •  09-17-2008, 10:03 AM 4772 in reply to 4771

    Re: AD User attributes using AccountManagement

    I asked my Domain Admin and he said it means "Managed By" in the AD. My boss said he thinks it's just a title. I haven't had time to do a search on it yet since I didn't know what it was called exactly. I was trying to use the "manager" attribute which is put into a custom identifier by the Ad add user web application that is used to put in the user.
    Web Developer
    Daxcon Engineering
  •  09-17-2008, 10:49 AM 4774 in reply to 4772

    Re: AD User attributes using AccountManagement

    If you want to read the managedBy attribute on an organizationalUnit object, you can't do that with SDS.AM because it only provides a wrapper around user, group and computer objects.

    You can read the managedBy attribute on an OU using SDS or SDS.P if that information is meaningful to you for your purpose.

View as RSS news feed in XML