How to query all contacts of all users, and use this address to display insufficient permissions

Yanzi Zheng 郑燕子 21 Reputation points
2022-11-28T11:21:24.327+00:00

How to query all contacts of all users, and use this address to display insufficient permissions

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

What permissions need to be authorized to access

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

Accepted answer
  1. CarlZhao-MSFT 39,736 Reputation points
    2022-11-29T02:34:54.17+00:00

    Hi @Yanzi Zheng 郑燕子

    You have not consented to the permissions.

    264939-page19.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. RajeshKumarMSFT 1,971 Reputation points Microsoft Vendor
    2022-11-28T15:48:07.903+00:00

    Hi @Yanzi Zheng 郑燕子 ,

    Hope you are doing well,

    We can get the contacts of other users using Both Application & Delegated permissions Refer

    264817-image.png

    I am able to get contacts from other user using Application permissions, please find attached screenshot below.

    264818-image.png

    For Additional reference please follow this link
    If the answer is helpful, please click Accept Answer and kindly Upvote. If you have any further questions about this answer, please click Comment.


  2. Vicky Kumar (Mindtree Consulting PVT LTD) 1,166 Reputation points Microsoft Employee
    2022-12-01T10:20:02.377+00:00

    As per the docs with the help of with application permission, user can only be able to access default contacts folder of the signed-in user.

    To get contacts of another user's contact folder, only If the app has the appropriate delegated permissions from one user, and another user has shared a contact folder with that user, or, has given delegated access to that user , by using below API call

    GET /users/{id | userPrincipalName}/contactfolders/{id}/contacts
    GET /users/{id | userPrincipalName}/contactFolders/{id}/childFolders/{id}/contacts

    Hope this will help

    Thanks.

    0 comments No comments