web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Fetching User details from Active Directory Groups

(0) ShareShare
ReportReport
Posted on by 45

In Ax 2012 I want to fetch all user's information like name, title,department,company name, group they belong...etc irrespective to domain who belong to the different Active Directory Groups present in ax. 

*This post is locked for comments

I have the same question (0)
  • Gopinathan Profile Picture
    45 on at

    Hi All,

    Pls tell me the possibilities...

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Please use the below job to get the user details.

    static void userInfo(Args _args)
    {
    UserInfo userInfo;
    RefRecId recId;
    DirPersonUser personUser;
    HcmWorker worker;
    DirPerson dirPerson;
    Name name;
    UserGroupInfo userGroupInfo;
    UserGroupList userGroupList;

    while select firstOnly id, name, company, networkDomain from userInfo // Fetches userId, username, user AD
    join userGroupList
    where userGroupList.userId == userInfo.id
    join userGroupInfo
    where userGroupInfo.id == UserGroupList.groupId
    join personUser
    where personUser.User == userInfo.id
    join worker
    where worker.Person == personUser.PersonParty
    outer join ProfessionalTitle from dirPerson // Professional title
    where dirPerson.RecId == worker.Person
    {
    name = HcmWorker::getDepartments(recId).Name; // Department name

    info(strFmt("Id: %1, Name: %2, UserGroup: %3, Network Domain: %4, CompanyName: %5, Department: %6 Title: %7",
    userInfo.id, userInfo.name, userGroupInfo.id, userInfo.networkDomain, userInfo.company,name, dirPerson.ProfessionalTitle));
    }
    }

    Thanks,

    Chaitanya Golla

  • Gopinathan Profile Picture
    45 on at

    Hi Chaitanya Golla,

                        Actually the code which you have posted is for retrieving users belonging to AX informations, I am in need of user information with respect Active Directory Groups

    Thanks,

    Gopinathan

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    If you want to traverse active directory, you could just do it in a C# wrapper and consume it from AX. You could also implement it in X++ if you want to since you have access to the .Net namespaces, whichever is easier for you.

    There are a lot of examples:

    stackoverflow.com/.../get-members-of-active-directory-group-and-check-if-they-are-enabled-or-disabled

    stackoverflow.com/.../get-all-users-from-a-group-in-active-directory

    stackoverflow.com/.../retrieve-all-the-users-in-an-active-directory-group-using-c-sharp

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans