List directReports
Namespace: microsoft.graph
Get a user's direct reports. Returns the users and contacts for whom this user is assigned as manager. This API doesn't support getting the direct report chain beyond the specified user's direct reports.
This API is available in the following national cloud deployments.
Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | User.Read and User.ReadBasic.All, User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported |
Application | User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All |
Important
When an application queries a relationship that returns a directoryObject type collection, if it doesn't have permission to read a certain resource type, members of that type are returned but with limited information. For example, only the @odata.type property for the object type and the id is returned, while other properties are indicated as null
. With this behavior, applications can request the least privileged permissions they need, rather than rely on the set of Directory.* permissions. For details, see Limited information returned for inaccessible member objects.
HTTP request
To retrieve the direct reports of a user:
GET /me/directReports
GET /users/{id | userPrincipalName}/directReports
To retrieve the user and their direct reports, use the $expand
query parameter:
Note:
$expand
returns a maximum of 20 objects. For details, see query parameter limitations.
GET /me?$expand=directReports
GET /users/{id | userPrincipalName}?$expand=directReports
Optional query parameters
This method supports the $select
, $count
, $expand
, and $filter
OData query parameters to help customize the response. You can use $select
nested in the $expand
expression. For example, me?$expand=($select=id,displayName)
. Some queries are supported only when you use the ConsistencyLevel header set to eventual
and $count
. For more information, see Advanced query capabilities on directory objects.
Request headers
Header | Value |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | application/json |
ConsistencyLevel | eventual. This header and $count are required when using $search , or in specific usage of $filter . For more information about the use of ConsistencyLevel and $count , see Advanced query capabilities on directory objects. |
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of directoryObject objects in the response body.
Example
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/me/directReports
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.user",
"id": "6ea91a8d-e32e-41a1-b7bd-d2d185eed0e0",
"businessPhones": [],
"displayName": "Conf Room Adams",
"givenName": null,
"jobTitle": null,
"mail": "Adams@contoso.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "Adams@contoso.com"
}
]
}
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk