title: Get all messages from Outlook API
body: <p>I'm consuming the Outlook API, attempting to access all messages from an inbox which contains ~45,000 messages (and other folders such as Sent Items).</p>
  
  <p>The main request I'm making is to <a href="https://outlook.office.com/api/v2.0/me/messages" rel="nofollow noreferrer">https://outlook.office.com/api/v2.0/me/messages</a>. If I add ?$count=true, the <code>"@odata.count"</code> value is returned as -1.</p>
  
  <p>I can add $top=500 to the request which gives me 500 messages returned and an <code>"@odata.nextLink"</code>, but if I pass $top=5000, there's no <code>"@odata.nextLink"</code> which I'd expect to see.</p>
  
  <p>A few particular questions here if anyone can help:</p>
  
  <ol>
  <li>Is this the best way to try and get all the messages out of all folders?</li>
  <li>Is there a reason count would be returning -1, and is there a way to get an accurate figure of the number of messages returned?</li>
  <li>Is there a maximum $top size I need to pass to get a valid request back? </li>
  </ol>