Allow to use $expand for photo metadata when getting Personal contacts
https://graph.microsoft.com/v1.0/me/contacts/{id}?$expand=photo
Should return a contact object with a field stating whether the contact has a photo or not
This was already kind of discussed here and here and the response was that this is not possible because "photo" has a binary response while the get contact endpoint returns a json.
however with contacts profilePhoto there are two separate endpoints:
GET /me/contacts/{id}/photo/$value
return the photo itself in binary stream
GET /me/contacts/{id}/photo
returns metadata of the contact's photo - this is extremely useful for figuring out if that contact has a photo or not
by the way, supplying the above "$expand" option doesn't fail the API call, it will add the following header to the json response: "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('Email address removed')/contacts(photo())/$entity", however no field is added to the json object that could help us figure out if that contact has a photo or not.
Some Background:
There may be thousands of contacts in the account, if you want to list them all you don't need too many network calls as you can use:
/me/contacts/microsoft.graph.delta
with header: `Prefer=odata.maxpagesize=300`
but if you want to show photos of those contacts you can't do it for many contacts at once, if you use batches you can do up to 4 contacts at a time, which results in potentially thousands of API calls where most would probably return 404 since the contact doesn't have a photo. Adding the photo existence field using the $expand would solve this and allow us to reduce our API calls dramatically