C# and Exchange Web Service using a service account-Error
<p>I am trying to access the inbox of a "Notification" email address using a service account.  This service account has the same access permissions as my account, but does not have its own email address, it is simply a service account.  When I use my account, the below test code works, however when I use the service account I get the below error:</p>

<blockquote>
  <p>When making a request as an account that does not have a mailbox, you
  must specify the mailbox primary SMTP address for any distinguished
  folder Ids.</p>
</blockquote>

<p>This code currently should simply display how many emails in the inbox has the subject of 'test'.  I have tried the suggested answer of many posts on this site, and none have worked.  Thanks for your help.  Below is the code:</p>

<pre><code>ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new WebCredentials("ServiceAccount", "Password");
service.AutodiscoverUrl("ScriptNotifications@domain.com", RedirectionUrlValidationCallback);
ItemView mView = new ItemView(10);
mView.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
string querystring = "subject:\"test\"";
Console.WriteLine("Total emails whos subject is 'test':");
FindItemsResults&lt;Item&gt; results = service.FindItems(new FolderId(WellKnownFolderName.Inbox, new Mailbox("ScriptNotifications@domain.com")), querystring, mView);
Console.WriteLine(results.Items.Count.ToString());
</code></pre>

<p>UPDATE:</p>

<p>I wanted to add Noonand's code, since that gives me a different error.  Editing to fit into one block rather than using methods, here is the code:</p>

<pre><code>ImpersonatedUserId impersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "smtp.mysmtpaddress.com");
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new NetworkCredential("ServiceAccount", "Password");
service.ImpersonatedUserId = impersonatedUserId;
service.AutodiscoverUrl("ScriptNotifications@domain.com", RedirectionUrlValidationCallback);
try
{
    AlternateIdBase response =
        service.ConvertId(new AlternateId(IdFormat.EwsId, "Placeholder", "ScriptNotifications@domain.com"), IdFormat.EwsId);


}
catch (ServiceResponseException)
{
    // Expected exception, see EWS documentation
    // Nonetheless, the credentials provided can authenticate successfully against this Exchange box

}
ItemView mView = new ItemView(10);
mView.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);
string querystring = "subject:\"test\"";
Console.WriteLine("Total emails whos subject is 'test':");
FindItemsResults&lt;Item&gt; results = service.FindItems(new FolderId(WellKnownFolderName.Inbox, new Mailbox("ScriptNotifications@domain.com")), querystring, mView);
Console.WriteLine(results.Items.Count.ToString());
</code></pre>

<p>When I run that code, I get the below error at the "FindItemResults" line:</p>

<blockquote>
  <p>The SMTP address has no mailbox associated with it.</p>
</blockquote>

<p>UPDATE 2:</p>

<p>Thanks to Noonand, I believe the error is a bug in Exchange Server 2013 itself.  See below for the link:</p>

<p><a href="https://support.microsoft.com/en-us/kb/3006861" rel="nofollow">https://support.microsoft.com/en-us/kb/3006861</a></p>

<p>I have to wait until the change process goes through in my company before I make this update, which could take a long time, but I wanted to put this out there so others who have the same problem may see this and be helped.</p>