Trying to get all contacts from a company using microsoft, but doesn't seem to be all

Daniel Dunér 1 Reputation point
2023-01-27T08:35:31.52+00:00

Hi I am calling the following endpoints:

const MICROSOFT_ENDPOINTS = [
  /** CONTACTS */
  "/me/contacts",
  /** ORG CONTACTS */
  "/contacts",
  /** USERS */
  "/users"
];

and with the following permissions

	
https://graph.microsoft.com/Contacts.Read
https://graph.microsoft.com/OrgContact.Read.All
https://graph.microsoft.com/User.Read.All
offline_access

This has worked when I was testing however, this doesn't work for one of our consumers. My question is there anywhere else a company using microsoft services can store the contacts, where we are not fetching from?

(What I am interested in is the mail contacts, which they see in outlook when they write a mail, As I've understood the Microsoft Graph API i s to be used and not something from exchange)

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,586 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. 2023-01-30T13:58:57.28+00:00

    Hi @Daniel Dunér

    To get the contacts from user mailbox please check the below query:

    GET /me/contacts/{id}
    GET /users/{id | userPrincipalName}/contacts/{id}
    

    The permissions required for these are:

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


  2. HarmeetSingh7172 4,811 Reputation points
    2023-01-31T23:39:38.2466667+00:00

    Hello @Daniel Dunér

    Thanks for reaching out!

    Contacts can be organizational and personal.

    • A contact is an item in Outlook where you can organize and save information about the people and organizations you communicate with. Contacts are contained in contact folders.
    • Organizational contacts are managed by an organization's administrators and are different from personal contacts. Additionally, organizational contacts are either synchronized from on-premises directories or from Exchange Online and are read-only in Microsoft Graph.

    Please note that Person resource is an aggregation of information about a person from across mail and contacts. People can be local contacts or your organization's directory, and people from recent communications (such as email).

    The endpoint and the permissions which you using to list contacts are correct. Please give consent to Directory.Read.All permission and re-test the API.

    However, if the issue persists and it could be a tenant specific issue, I recommend you raise a support case with Microsoft Graph, a Support Engineer will be able to look into the issue and assist you better. You can raise support ticket from http://aad.portal.azure.com/ or https://admin.microsoft.com/#/support/requests.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments