Enumerating user and group membership for an entire site.
June 24, 2008 Leave a comment
Stsadm will let you list the groups on your sharepoint site. It will also let you list the users on your sharepoint site. It just wont let you enumerate the group memberships of the users on your site.
This really simple SQL query will list all active users on the site and the groups they are members of.
SELECT Groups.Title, UserInfo.tp_Login, UserInfo.tp_Title, UserInfo.tp_Email
FROM GroupMembership INNER JOIN
Groups ON GroupMembership.GroupId = Groups.ID INNER JOIN
UserInfo ON GroupMembership.MemberId = UserInfo.tp_ID
where userinfo.tp_isactive = '1'
order by userinfo.tp_Login
It does the trick, but not as well as a custom stsadm extension. Maybe next time.