Skip to main content

Notifications

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

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Fetching User details from Active Directory Groups

    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

  • Gopinathan Profile Picture
    Gopinathan 45 on at
    RE: Fetching User details from Active Directory Groups

    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
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: Fetching User details from Active Directory Groups

    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
    Gopinathan 45 on at
    RE: Fetching User details from Active Directory Groups

    Hi All,

    Pls tell me the possibilities...

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans