Geeks With Blogs

About Me:
I am a Female SharePoint Developer (a platinum unicorn). I have been working with SharePoint since I attended the Portal University in 2005. I hold a BA in Computer Science from the University of Missouri - Kansas City. I love playing Rockband, organizing user group meetings, working with code, attending events as a speaker or organizer, and having bizarre conversations about geek things with cool people. If you have any comments or questions fill out the contact form and I will try my best to help.

The Guide of a MOSSLover Becky Isserman's Blog
I was playing around with another  user control yesterday that would allow me to show people who is inside an AD Group.  Unfortunately, in the object model (as far as I can tell) there is one function "IsDomainGroup" that can even help out.  So that inevitably brought me to use this AD Wrapper that someone created in my company.  It will display the group users on a windows app on the server or on an asp .net application on the server in the c:/program files/common files/microsoft shared/web server extensions/12/templates/layouts.  When I try to use it off the server it gives me a nasty error message that I do not have permissions to use System.DirectoryServices.  So far I have done some googling and I saw an article about how I should change the web.config to full control.  This is a no go for security reasons I am not moving from wss_medium.  I find these answers unacceptable and I am going to look around for another answer.  There are always ten answers to one problem and fifty other steps in between that vary on the process you take.  Just remember that when you are working on a problem that is incredibly hard to solve.  There is never just one answer. Posted on Saturday, April 12, 2008 10:30 AM MOSS | Back to top

Comments on this post: System.Directoryservices won't appease me...

# re: System.Directoryservices won't appease me...
Requesting Gravatar...
How about SPSecurity.RunWithElevatedPrivileges?
Left by J on Apr 13, 2008 11:32 AM

# re: System.Directoryservices won't appease me...
Requesting Gravatar...
I already put that in the code...I should have mentioned you need to add that piece of code and elevate the web.config.
Left by MOSSLover on Apr 13, 2008 11:40 AM

# re: System.Directoryservices won't appease me...
Requesting Gravatar...
Here's some code I did awhile ago to check whether a user was an administrator, this could be modified to check for whether they're in any security group or return an array of groups they belong too.

private void disable_controls()
//get identity and groups user belongs to for admin check
System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);

string[] adminGrps = new string[] { "Administrators", "Domain Admins" };
foreach (string admin in adminGrps)
bool value = principal.IsInRole(domainName + "\\" + admin);

That should get you started
Left by AlphaAlien on Apr 15, 2008 1:43 PM

# re: System.Directoryservices won't appease me...
Requesting Gravatar...
I think that System.Security.Principal can be used to get the users within a group too. Thanks for posting that information. You rock.
Left by MOSSLover on Apr 15, 2008 4:49 PM

Your comment:
 (will show your gravatar)

Copyright © MOSSLover | Powered by: