title: ExchangeServiceBinding namespace error
body: <p>Summary: application will not accept the <code>ExchangeServiceBinding</code> command.</p>
  
  <hr>
  
  <p>Details:</p>
  
  <p>I am trying to loop through a very large mailbox, so I am using an index to break the inbox into 200 email chunks. The only example I could find (shown below) keeps returning</p>
  
  <blockquote>
    <p>the type or namespace name “ExchangeServiceBinding” could not be found (are you missing a using directive or an assembly reference? )</p>
  </blockquote>
  
  <p>Which I find strange, because I am using it <code>using Microsoft.Exchange.WebServices;</code>. Any ideas or help is greatly appreciated. I am running Windows&nbsp;7 and Visual Studio 2010 and trying to access Exchange 2007 mailboxes.</p>
  
  <hr>
  
  <p>Things I've tried:</p>
  
  <ul>
  <li>searching Google</li>
  <li>searching Stack&nbsp;Overflow</li>
  <li>searching MSDN</li>
  <li>slamming my head on my desk</li>
  <li>trial and error</li>
  </ul>
  
  <hr>
  
  <p>Code:</p>
  
  <pre><code>// Create binding variable to be used for GetItemsFromInbox().
  // Set up the binding with credentials and URL.
  ExchangeServiceBinding binding = new ExchangeServiceBinding();
  binding.Credentials = new NetworkCredential(dUser, dPassword, dDomain);
  binding.Url = new Uri("https://" + ExchangeServerName + "/EWS/Exchange.asmx");
  
  // Set up the binding for Exchange impersonation.
  binding.ExchangeImpersonation = new ExchangeImpersonationType();
  binding.ExchangeImpersonation.ConnectingSID = new ConnectingSIDType();
  binding.ExchangeImpersonation.ConnectingSID.PrimarySmtpAddress = "mailboxnamehere”;
  
  // Call GetItemsFromInbox()
  int index = 0;
  bool looping = true;
  
  while (looping)
  {
      List&lt;ItemType&gt; items = GetItemsFromInbox(binding, index, 200, index);
      if (items == null || items.count == 0)
      {
          looping = false;
          break;
      }
      // Do your work here
  }
  </code></pre>