title: How to know if user has a mailbox on Exchange using C# or PowerShell
body: <p>We developed a SharePoint web part that displays selected users's calender items by requesting Exchange OnPrem 2013 or Exchange Online for users that have thier mailbox on Office 365. The code we're using is as follows :</p>
  
  <pre><code>// Impersonate the Search
  ExchangeImpersonationType exchangeImpersonationType = new ExchangeImpersonationType();
  
  ConnectingSIDType connectingSIDType = new ConnectingSIDType();
  connectingSIDType.PrimarySmtpAddress = emailAddress;
  exchangeImpersonationType.ConnectingSID = connectingSIDType;
  exchangeServiceBinding.ExchangeImpersonation = exchangeImpersonationType;
  
  // Create the Request
  FindItemType findItemType = new FindItemType();
  
  // Specified Transversal
  findItemType.Traversal = ItemQueryTraversalType.Shallow;
  
  // Specified ItemShape
  ItemResponseShapeType itemResponseShapeType = new ItemResponseShapeType();
  itemResponseShapeType.BaseShape = DefaultShapeNamesType.AllProperties;
  findItemType.ItemShape = itemResponseShapeType;
  
  // Specified ParentFolderIds
  DistinguishedFolderIdType[] distinguishedFolderIdTypes = new DistinguishedFolderIdType[1];
  distinguishedFolderIdTypes[0] = new DistinguishedFolderIdType();
  distinguishedFolderIdTypes[0].Id = DistinguishedFolderIdNameType.calendar;
  findItemType.ParentFolderIds = distinguishedFolderIdTypes;
  
  // Specified Item
  CalendarViewType calendarViewType = new CalendarViewType();
  calendarViewType.StartDate = startDate;
  calendarViewType.EndDate = endDate;
  
  findItemType.Item = calendarViewType;
  
  // Execute the Request
  FindItemResponseType res = exchangeServiceBinding.FindItem(findItemType);
  </code></pre>
  
  <p>The issue is that when user doesn't have a mailbox on Exchange OnPrem, the <code>exchangeServiceBinding.FindItem</code> method answers after 3 to 5 secondes with the error code "UserHasNoMailbox".</p>
  
  <p>Imagine now loading a page with more thant 40 users and having 10 users among them that have mailbox on Exchange Online, we're losing at least 30 secondes in this case.</p>
  
  <p>Is there any way to know if user has mailbox on Exchange OnPrem without making the <code>FindItem</code> request ?</p>
  
  <p>Thanks.</p>