tags:

views:

599

answers:

2

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?

+3  A: 

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.

jrista
+1 I Could have really used this for a project about a year ago I ended up rolling one from scratch.One for the bookmarks, thanks
kerchingo
@kerchingo: Sorry I wasn't looking a year ago. :P I hope this question/answer will be picked up by the search engines, though. There is nothing else out there that relates "Select Users or Groups" and "Active Directory Object Picker" together, so its near impossible to find helpful information.
jrista
A: 

http://adui.codeplex.com/ - it's good implementation but it has memory leak that i couldn't remove. If you use it and try to open ad picker dialog multiple times you'll receive AccessViolationException to read/write memory. It's bad sign.

I've used another wrapper from here. It should be a little bit customized in code but AccessViolationExceptions.

Regfor
ADUI is what I used, if you read my own answer. I linked a solution to the memory leak which caused crashes, as well. So far, I have it working perfectly on both 32bit and 64bit systems.
jrista