Showing posts with label AdObject Class in axapta. Show all posts
Showing posts with label AdObject Class in axapta. Show all posts

Jul 11, 2012

Example of AdObject class in Dynamics AX 2009

If you want to know the user details in a domain in Axapta. Here is a class called AdObject, by using this class we can get the Active directory information.

I am sharing a simple job which will describe how to know the user name and mail address of a particular valid domain user.

Just try it this job if you want to know how this class works.


Static void AdObjectExample(Args _args)
{
    AdObject adObject = new AdObject("venkateswararao.g");
    str Name;
    str MailAddr;
    #define.givenname ("Name")
    #define.mail ("Mail-Id")

    ;
    if(!adObject)
    {
        checkFailed("given Name is Invalid");
    }
    else if(adObject.found())
      {
        Name = adObject.getValue("#givenname");
        MailAddr  = adObject.getValue("mail");
        info("Name is "+Name);
        info("Mail Address is "+MailAddr);

      }
}


You will get a screen as shown below