使用 wss 3.0 获取电子邮件管理员

问题描述 投票:0回答:1

如何使用wss 3.0获取网站集管理员的所有电子邮件?

visual-studio-2010 sharepoint sharepoint-2010 windows-sharepoint-services
1个回答
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();
   }

请注意,站点管理员要求上下文用户是网站集审核员

© www.soinside.com 2019 - 2024. All rights reserved.