Announcements
No record found.
Hello,I am working on an AX customisation where I need to query user information in AD. I am relying on the following class:directorySearcher = new System.DirectoryServices.DirectorySearcher(entry);However, due to the nature of the requirements I would like - in this particular case - for this class to operate under the user credentials of a specific user - not the current AX user.Is there anyway to achieve this in AX? I.e. instantiate the DirectorySearcher class under the credentials and rights of a different user?Best regards,Grzegorz Skrzypczyk
Even if that would be possible, you would need to provide the credentials of that user.
So why not just login to AX with that correct user in the first place? You could let this user set up a batch that runs your code. That way it's executed with this user's identity.
Well I would prefer not to go into the details of the why. Let's say this is to handle an exceptional case which concerns a few users in an organisation counting many thousands. It is either this or a very tedious workaround.
A batch could work - but ideally we would want this to be in interactive code.
Storing the credentials is not a problem.
Look at runAs() function - that's what the system uses in places like in batch and AIF, where there is a global process doing thing on behalf of (and the security context of) actual users.
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 771
André Arnaud de Cal... 629 Super User 2026 Season 1
Subra 496