Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display "Select Users and Groups" dialog from WPF application?

Tags:

.net

dialog

wpf

I need to display the standard "Select Users and Groups" dialog from a .NET/WPF application. I also need to be able to display it under a 64bit OS. I found this CodeProject article, which is quite ancient, dating back to the .NET 1.1 days. It is written in Managed C++ and exposed as a COM object, which will not work for my needs.

Has anyone implemented, or know of an implementation, of a pure .NET/C# wrapper for displaying and interacting with the standard system "Select Users and Groups" dialog that will work with a WPF application?

like image 560
jrista Avatar asked Oct 04 '09 07:10

jrista


2 Answers

Well, I found a solution. Turns out I was searching for the wrong thing. Instead of "Select Users or Groups", the correct thing to search for is "Active Directory Object Picker". The ADOP is the common dialog that is used to pick any object from Active Directory, including users, groups, computers, etc. It just so happens that this dialog is titled "Select Users or Groups" most of the time.

For the benefit of anyone else who has run into this problem, I'm posting a link to a CodePlex project, Active Directory Common Dialogs .NET that provides a very easy to use .NET wrapper for this dialog. Makes it pretty much as easy to use as any other common .NET dialog:

http://adui.codeplex.com/

For those of you running on a 64bit operating system, or a more modern operating system (Win2k8+), you may encounter a crash after selecting users or groups and choosing ok. The solution to the problem is here:

http://www.codeplex.com/ADUI/Thread/View.aspx?ThreadId=38047

Hope this helps anyone else who was/is looking for the same thing.

like image 72
jrista Avatar answered Nov 08 '22 01:11

jrista


We have created a NuGet available at https://github.com/Tulpep/Active-Directory-Object-Picker.

It is based on this project https://adui.codeplex.com/, the project mentionet by others, but with the memory leak fixed.

like image 29
Ricardo Polo Jaramillo Avatar answered Nov 07 '22 23:11

Ricardo Polo Jaramillo