how to retrive details from Active Directory through AxCode

Hi All,

Is it possible to get the active directory user credebtial details through Ax Code? If yes, how can i do it…plz provided some samples…

I have not done this before but i can give a hint to you. In Axapta X++, u can access the .NET Framework Libraries and for active directory there is one library called as System.DirectoryServices. So, try referencing in your code to access domain services.


I have already used like the below codding says :

static void CreateUserInActiveDirectory(Args _args)
str userName = “NewUser”;
str userPassword = “password”;
str userGUID;
str connection;
System.DirectoryServices.DirectoryEntry directoryEntry;
System.DirectoryServices.DirectoryEntry newUser;
System.DirectoryServices.DirectoryEntries children;
System.Object[] parameters;

parameters = new System.Object1;

parameters.SetValue(userPassword, 0);
connection = “LDAP://dc=Contoso,dc=com”;
directoryEntry = new System.DirectoryServices.DirectoryEntry(connection);
children = directoryEntry.get_Children();
newUser = children.Add(“CN=” + userName, “user”);
userGUID = newUser.get_Guid();

newUser.Invoke(“SetPassword”, parameters);
catch (Exception::CLRError)
throw error(“An error occurred.”);


But, there is very simple code to execute even within a job itself…I too done that also before but i lost my xpo’s and i forgot the method which i have done… Now i am wondering how have i done that… So plz help out to find that…

Thanks in Advance


I remember seeing various articles in Internet for reading info from AD. The one I could remember is this -

Also if you haven’t done so, would suggest you to search here.

Hello Harish Sir,

Thank you for the link…This is very helpful for me…Thank you very much :slight_smile:

I am newbie and not know much about it. But Google is your friend. It gives you the best solution .


I found out the exact link… Thank you for ur good time for me :slight_smile: honeyclarck