When login into the outlook office 365 interface to manage his/her contacts, a user would click on the blue icon with nine squares at the top left of the UI and select the "Contacts" tile. On the left, the user would see the folders "My contacts", "Directory" and "Groups". At least, this is what I see.
I managed to use the REST API of office 365 to query the contacts listed in "My contacts" as follow:
GET outlook.office365.com/api/v1.0/me/contacts?$top=200
And I was happy. But I have been asked to import the contacts listed in the "Directory" folder.
So I browsed a bit in the doc and saw I could query specific contact folders doing:
GET https://outlook.office.com/api/{version}/me/contactfolders/{contact_folder_id}/contacts
The problem is that I cannot find the {contact_folder_id} corresponding to "Directory". A query to endpoint:
GET https://outlook.office.com/api/{version}/me/contactfolders
returns an empty array, I do not even see the "My contacts" folder.
Any idea of how I could get those? I am secretly fearing that I have to talk with the global Graph API to get those AzureAD contacts, which would mean I should get a new token, complicating a bit the code. If there is a simpler way to do so, it would be very helpful!