如何使用wss 3.0获取网站集管理员的所有电子邮件?
尝试:
private string[] GetEmails(SPWeb web)
{
List<string> emails = new List<string>();
Guid siteID = web.Site.ID;
Guid webID = web.ID;
using (SPSite site = new SPSite(siteID, SPUserToken.SystemAccount))
{
using (SPWeb web1 = site.OpenWeb(webID))
{
SPUserCollection admins = web1.SiteAdministrators;
foreach (SPUser admin in admins)
{
emails.Add(admin.Email);
}
}
}
return emails.ToArray();
}