Microsoft Graph how to search contacts by emailAddresses with odata? - microsoft-graph-api

Is there any way I can search by email in Contacts with Microsoft Graph?
/v1.0/me/contacts?$filter=emailAddresses/any(a:startwith(a/address,'john'))
The second one does not work as it required to enter the full address.
Is the documentation wrong?
/v1.0/me/contacts?$filter=emailAddresses/any(a:a/address eq '#domain.com')

Related

is it possible to get the specific Teams contacts list of a user?

I've searched a lot and apparently with the Microsoft Graph API we can get the organization contacts/users list and the default contacts list of a user across Office 365 as well, but I am afraid I won't be able to get the specific Teams list of contacts of a user
Can someone please confirm this to me and perhaps give me suggestions of some other alternative?

Retrieving the image of a user through Microsoft graph api

I am trying to fetch the image of a user based on email id from microsoft graph API.
I am able to get the details of the logged in user using https://graph.microsoft.com/v1.0/me/photo/$value .
What i need is image of another user based on email id. Is there a way to accomplish this?
Ref: Microsoft Graph API Explorer
You can use the below api from the graph explorer to get the photo
Goto Graph explorer page
Microsoft Graph Explorer
Paste the below api with email id of the user
https://graph.microsoft.com/v1.0/users/<email id>/photo/$value
It will retrieve photo of the user.

How to get the Department field from the Office profile using Microsoft Graph?

I'm trying to get the Department field from the Contact Information in the Office 365 profile using the Microsoft Graph API, but the data being returned doesn't match.
Screenshot of contact information in office.com
Screenshot of the query in the Graph Explorer
Example:
Office 365 user profile page: https://nam.delve.office.com/?u=d10110c2-5f89-40dc-8db2-323e35e24f73&v=editprofile
Microsoft Graph API query: https://graph.microsoft.com/v1.0/me/department
Microsoft Graph API query result:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('d10110c2-5f89-40dc-8db2-323e35e24f73')/department",
"value": "Clinical"
}
I logged into office.com and the Microsoft Graph Explorer using the same account, and all fields seems to match, except this particular field which doesn't.
Could anyone help me find out what am I missing there?
I am not able to repro this behavior. For me, a response from graph API matches the department name stated on the profile page(office.com)
Couple of things to check here -
Make sure you are logged in with correct account at both places.
If not, please share actual screen shot from both places. Also please share request timestamp and client id from graph call.
Hope this helps. Thanks!

Graph API - How do I determined linked contacts?

In Office 365 Contacts UI you can have contacts that are linked. When retrieving the contacts through the Graph API endpoint https://graph.microsoft.com/v1.0/me/contacts there is no field that indicates that the contacts are linked.
Contacts can be linked when they are created with the same email or you can specify any two contacts to link. So it is important to know when contacts are linked as they share data.
Using https://outlook.office.com/api/beta/me/contacts I have the PersonId field which allows me to determine a link.
How do I determine if a contact is linked and who it is linked to in the Graph API?

Global Address List Graph API

I am trying to use the Graph API inside an Office 365 add-in to get contact information out of GAL. Neither of the following queries return any contacts from the GAL, although both return some information.
beta/me/contacts?$filter=displayName eq 'John Smith'
beta/me/people?$filter=displayName eq 'John Smith'
Is it possible to get contacts from the GAL using the Graph API? I having a feeling I am not giving my app the correct permission to access the GAL.
The /me/contacts endpoint returns the contacts from your default Outlook Contacts folder. The /me/people endpoint is similar but attempts to pull information on contacts access multiple sources.
The GAL represents contact information from your organization (i.e. Active Directory). To see the contact information for other users in your organization, you use the /users endpoint. To see organizational contacts (contacts added to the AD/GAL) you need to use the /contacts endpoint (note the lack of /me/ in the path).

Resources