I'm trying to work out what I'm doing wrong. I'm trying to get all the contacts from O365 in a XML or JSON format so I started looking into it and found out that Microsoft has a API which will return the data in JSON (perfect!).
The API is accessible at: https://outlook.office365.com/api/v1.0/me/contacts I opened the link in a browser, and all was OK, except that it only returns the first 10 contacts. I do not need this to be incorporated into any kind of software or program or anything I just need to get it trough the browser. Am I missing something or is there any other way how I can get all the contacts flushed in a very basic format?
Thanks for any tip.
The default for the API is to return only 10 entries per request. You can increase this up to 50. For larger result sets you have to use paging. http://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#UseODataqueryparametersPageresults
So in the browser, you could do: https://outlook.office365.com/api/v1.0/me/contacts/$count
That would tell you how many total you have. Then you can grab the first 50: https://outlook.office365.com/api/v1.0/me/contacts?$top=50
If you have more, you can grab the next 50 with the $skip parameter: https://outlook.office365.com/api/v1.0/me/contacts?$top=50&$skip=50
And so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With