-2

Teams has a tab called Organization, that looks like this: enter image description here Where is this data stored/ how could I recreate this data in c#? Is this something that can be pulled with the teams api?

EDIT: Found the issue, It turns out the data was there, but graph only returns 100 results at a time : https://stackoverflow.com/a/56707771/11875152

Luke Vanzweden
  • 466
  • 3
  • 15
  • 1
    Have you read [the documentation](https://learn.microsoft.com/en-us/graph/overview?view=graph-rest-1.0)? It looks like an [organization resource type](https://learn.microsoft.com/en-us/graph/api/resources/organization?view=graph-rest-1.0) is available. – tnw Jan 05 '21 at 15:54
  • @tnw I dont understand. How could I get heirarchy data from that? If you send that req, here : [link](https://learn.microsoft.com/en-us/graph/api/organization-get?view=graph-rest-1.0&tabs=http#code-try-1) it does not return anything about org data – Luke Vanzweden Jan 05 '21 at 16:04

1 Answers1

1

The API to get Organization Hierarchy of Azure AD is NOT exposed today. You can vote up the related User Voice Post.

Currently we can get one level managers or employees using Microsoft Graph API. (You can test it using Microsoft Graph Explorer)

List manager:

GET https://graph.microsoft.com/v1.0/users/{id|userPrincipalName}/manager

List directReports:

GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/directReports
Allen Wu
  • 15,529
  • 1
  • 9
  • 20
  • Any Idea where the teams data comes from? if I get all users with managers, it is not all users in the org. Somehow not all users have a manager in graph, but they do have a manager in teams. – Luke Vanzweden Jan 06 '21 at 03:25
  • 1
    @LukedukeAnimations I see from my side that they are consistent, maybe the data I tested is not sufficient. As far as I know, this data should be in AAD, and it is very likely that there is a set of synchronized data in Sharepoint. But as I have mentioned, there is not an API that can list the Organization Hierarchy. – Allen Wu Jan 06 '21 at 04:27
  • 1
    By using Graph call you will receive the [direct reporters](https://learn.microsoft.com/en-us/graph/api/user-list-directreports?view=graph-rest-1.0&tabs=csharp#request), and based on the result you need to handle custom logic to show on the repartees to respective manager on tab. – VaraPrasad-MSFT Jan 06 '21 at 05:49
  • @LukedukeAnimations Do you have any other concerns? If my answer is helpful for you, you can accept it as answer. Thank you. – Allen Wu Jan 08 '21 at 06:06
  • @AllenWu Sure, But It doesnt work for me. Not sure why, but it does not have a manager for many users in graph, but does in teams. – Luke Vanzweden Jan 08 '21 at 13:09
  • 1
    @AllenWu See the edit, The data was there, it just only returns 100 results at a time: https://stackoverflow.com/a/56707771/11875152 – Luke Vanzweden Jan 21 '21 at 18:32