Вопрос

How could obtain all e-mail from site collection's administrators using wss 3.0?

Это было полезно?

Решение

Try:

   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();
   }

Note that SiteAdministrators requires that the context user is a site collection auditor.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top