title: Determine Email Address of an AD Security Group
body: <p>In AD here at work, we have some security groups that are mail enabled.  I am using the  System.DirectoryServices.AccountManagement namespace like so:</p>
  
  <pre><code>        List&lt;GroupPrincipal&gt; result = new List&lt;GroupPrincipal&gt;();            
          using (PrincipalContext domain = new PrincipalContext(ContextType.Domain, userinfo[0]))
          using (UserPrincipal user = UserPrincipal.FindByIdentity(domain, username))
          {
  
              if (user != null)
              {
                  PrincipalSearchResult&lt;Principal&gt; groups = user.GetAuthorizationGroups();
  
                  int totalGroupCounter = 0;
                  StringBuilder output = new StringBuilder();
                  List&lt;GroupPrincipal&gt; securityGroups = new List&lt;GroupPrincipal&gt;();
                  List&lt;GroupPrincipal&gt; distributionGroups = new List&lt;GroupPrincipal&gt;();
  
                  foreach (Principal group in groups)
                  {
                      totalGroupCounter++;
  
                      if (((GroupPrincipal)group).IsSecurityGroup.Value)                        
                          securityGroups.Add((GroupPrincipal)group);                        
                      else                        
                          distributionGroups.Add((GroupPrincipal)group);                        
                  }                
              }
          }
  </code></pre>
  
  <p>Armed with this info, what's the correct way to find the group's email address?</p>