title: Outlook Add-In Get Recipient Count In Distribution Group
body: <p>I'm writing an Add-In for Outlook 2010 that should get the total number of people the recieving the email.</p>
  <p>I can get the email property fairly easily with the following code:</p>
  <pre class="lang-vb prettyprint-override"><code>Dim mailItem As MailItem
  mailItem = Globals.ThisAddIn.Application.ActiveInspector.CurrentItem
  </code></pre>
  <p><a href="http://msdn.microsoft.com/en-us/library/office/dn320330.aspx" rel="nofollow noreferrer"><code>MailItem</code></a> exposes some properties like:</p>
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/office/ff865320.aspx" rel="nofollow noreferrer"><code>MailItem.Recipients</code></a></li>
  <li><a href="http://msdn.microsoft.com/en-us/library/office/ff860378.aspx" rel="nofollow noreferrer"><code>MailItem.To</code></a></li>
  </ul>
  <p>However, if the email is going out to a <a href="http://office.microsoft.com/en-us/outlook-help/create-and-edit-a-contact-group-formerly-distribution-lists-HA010354963.aspx" rel="nofollow noreferrer">contact group (formerly distribution lists)</a>, <code>mailItem.Recipients.Count</code> will only return a value of <code>1</code>, even though multiple people will get the email.</p>
  <p>Is there a way to query the total number of recipients within a contact group?</p>
  <p>On some level it has to be possible, because Outlook will even do some of it for you:</p>
  <p><img src="https://i.imgur.com/wOVJS8r.png" alt="RecipientCount" /></p>