Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Listing of Site Members and Permissions

  Asked By: Karen Coleman         Date: Apr 18, 2010      Category: Sharepoint      Views: 276
 

Is there an easy way to export users and permissions for a site
collection? I would like to export them to excel.

Tagged:            

 

3 Answers Found

 
Answer #1       Answered By: Trinity Scott          Answered On: Apr 18, 2010       

Did you get a response to your query? I just received a similar
request from senior management to automatically notify site  owners who
has rights to their sites on a regular basis (let's say every 90 days).

Any insight you can provide is greatly appreciated.

 
Answer #2       Answered By: Constance Guerrero          Answered On: Apr 18, 2010       

No I haven't received any response to this inquiry. I haven't spent
much time on it lately. If I come accross anything I will post it
back to this thread.

 
Answer #3       Answered By: Chandrabhan Konwar          Answered On: Apr 18, 2010       

This piece of code looks for a single user and provides the sub-sites and group
roles (reader, contributor, etc.) - but it could easily be modified to loop
through sites to list user members  / group roles - then push it to a csv file
and inport to excel. using System;using System.Data;using System.Text;using
System.Configuration;using System.Collections;using System.Web;using
System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using
System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using
Microsoft.SharePoint;using Microsoft.SharePoint.Utilities;using
Microsoft.SharePoint.WebControls;namespace AdminTasks{ public partial class
WebForm15 : System.Web.UI.Page { protected void Page_Load(object
sender, EventArgs e) { } protected void
btSearch_Click(object sender, EventArgs e) {
StringBuilder stuser = new StringBuilder(); StringBuilder msg1 = new
StringBuilder();
int isinlist = 0; SPSite mySite =
SPControl.GetContextSite(Context); SPWebCollection myWebs =
mySite.AllWebs; { foreach (SPWeb subWeb in myWebs)
{ SPUserCollection allUsers = subWeb.Users;
switch(RadioButtonList1.SelectedIndex) {
case 0: foreach (SPUser user in allUsers)
{ if (user.Name.ToLower() ==
txName.Text.ToLower()) {
isinlist = 1; lbMem2.Text = user.Name + "
:: " + user.LoginName + " :: " + user.Email;
stuser.Append("<br> " + subWeb.Url.ToString());
SPRoleCollection allGroups = user.Roles;
foreach (SPRole group in allGroups)
{ stuser.Append("<b> - " +
group.Name + " -</b> "); }
} } break;
case 1: foreach (SPUser user in allUsers)
{ if (user.LoginName.ToLower() ==
txName.Text.ToLower()) {
isinlist = 1; lbMem2.Text = user.Name +
" :: " + user.LoginName + " :: " + user.Email;
stuser.Append("<br> " + subWeb.Url.ToString());
SPRoleCollection allGroups = user.Roles;
foreach (SPRole group in allGroups) {
stuser.Append("<b> - " + group.Name + " -</b> ");
} } }
break; case 2: foreach
(SPUser user in allUsers) {
if (user.Email.ToLower() == txName.Text.ToLower())
{ isinlist = 1;
lbMem2.Text = user.Name + " :: " + user.LoginName + " :: " + user.Email;
stuser.Append("<br> " + subWeb.Url.ToString());
SPRoleCollection allGroups = user.Roles;
foreach (SPRole group
in allGroups) {
stuser.Append("<b> - " + group.Name + " -</b> ");
} } }
break; } } }
if (isinlist == 0) { msg1.Append(txName.Text + " is
not a member of any sites or subsites<br><br>");
msg1.Append("Check spelling or try selecting another format <i>E-mail,
Login..</i> "); lbMem2.Text = msg1.ToString(); }
lbMem.Text = stuser.ToString(); }

 
Didn't find what you were looking for? Find more on Listing of Site Members and Permissions Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].