WriteLog("*************************************************************");
string s1="";
//richTextBox1.Text = "";
SPSite site = new SPSite(textBox1.Text);
SPWebCollection allweb = site.AllWebs;
foreach (SPWeb web in allweb)
{
WriteLog("********************"+ web.Url +"****************");
WriteLog("Web Site Url="+web.Url);
WriteLine("AllGroup");
foreach (SPGroup group in web.Groups)
{
s1 = "";
s1 = group.Name;
foreach (SPRole role in group.Roles)
{
s1 += "; Role =" + role.Name;
}
WriteLog(s1);
}
WriteLine(" All Users ");
foreach (SPUser user in web.AllUsers)
{
s1 = "";
s1 += "UserName = " + user.Name + "; Login = " + user.LoginName;
string r1 = "";
foreach (SPRole role in user.Roles)
{
s1 += "; Role =" + role.Name;
r1 += role.Name;
}
string g1 = "";
foreach (SPGroup group in user.Groups)
{
s1 += "; Group = " + group.Name;
g1 += group.Name;
}
if (g1 == "" && r1 == "")
break;
if (g1 == "" && r1 == "受限访问")
break;
WriteLog(s1);
}
WriteLine("All Lists");
foreach (SPList list in web.Lists)
{
s1="";
s1 = "List Name: "+list.Title;
WriteLog(s1);
foreach(SPPermission permission in list.Permissions)
{
if (permission.PermissionMask.ToString() == "134287360")
break;
s1 = " Member = " + permission.Member + "; Mask = " + permission.PermissionMask;
WriteLog(s1);
}
}
}
这个确实是sharepoint和ad缓存的问题,我记得sharepoint里有一个和ad同步的services,把那个service打开后,设置自动运行时间,运行后就可以了。我以前也遇到过这个问题,我们给客户设置的是一天运行一次这个services
楼上所说不错,确实是新建网站后会默认创建三个组。下面给你一个直观的操作地址,官网的。/zh-cn/sharepoint-server-help/HA101794106.aspx