title: Office 365 error Resource not found for the segment 'MailFolders'
body: <p>I am creating functionality in Asp.net webform to display Office 365 mails in one of my page.
  Currently I am using Microsoft.Office365.Discovery (v1.0.22) and Microsoft.Office365.OutlookServices (v1.0.41.0) nuget package.
  I need to display Folder wise total mail coundand total unread count but Microsoft.Office365.OutlookServices (v.1.0.41.0) does'n have such functionality.</p>
  
  <p>So i downloaded nugetpackage Microsoft.Office365.OutlookServices (v.2.0.1.0) which has properties UnreadItemCount  and TotalItemCount</p>
  
  <p>ex:</p>
  
  <pre><code>var folderResult = await outlookServicesClient.Me.MailFolders.ExecuteAsync();
  var cnt = folderResult.CurrentPage.ToList()[0].TotalItemCount;
  </code></pre>
  
  <p>but when i call ExecuteAsync() it gives below error:</p>
  
  <pre><code>{
     "error":
            {
                "code":"RequestBroker-ParseUri",
                "message":"Resource not found for the segment 'MailFolders'."
            }
  }
  </code></pre>
  
  <p>Is there anything wrong with it?</p>
  
  <p><code>Added How to use OutlookServicesClient</code></p>
  
  <pre><code>DiscoveryClient discClient = new DiscoveryClient(SettingsHelper.DiscoveryServiceEndpointUri,
              async () =&gt;
              {
                  var authResult = await authContext.AcquireTokenSilentAsync(SettingsHelper.DiscoveryServiceResourceId, new ClientCredential(SettingsHelper.ClientId, SettingsHelper.AppKey), new UserIdentifier(userObjectId, UserIdentifierType.UniqueId));
  
                  return authResult.AccessToken;
              });
  
              var dcr = await discClient.DiscoverCapabilityAsync(capabilityName);
  
              return new OutlookServicesClient(dcr.ServiceEndpointUri,
              async () =&gt;
              {
                  var authResult = await authContext.AcquireTokenSilentAsync(dcr.ServiceResourceId, new ClientCredential(SettingsHelper.ClientId, SettingsHelper.AppKey), new UserIdentifier(userObjectId, UserIdentifierType.UniqueId));
  
                  return authResult.AccessToken;
              });
  </code></pre>
  
  <p>and URLs that is used</p>
  
  <pre><code>    private static string _discoverySvcResourceId = "https://api.office.com/discovery/";
      private static string _discoverySvcEndpointUri = "https://api.office.com/discovery/v2.0/me/";
  </code></pre>