How to get Organisation Directory list from Microsoft Graph - microsoft-graph-api

Is there a way we can get Directory of all users? me/people gives relevant users which is not a complete list of users. We need to access complete list of users for searching.

The /users endpoint seems to be what you're looking for. Documentation is at https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list
For example, a call to GET https://graph.microsoft.com/v1.0/users should return a paged list of all users in the tenant.
I also recommend you take a look at the Graph explorer that has samples for querying this endpoint. You can view these by clicking the show more samples link.

Related

Retrieve all user details from Microsoft Graph API

I am trying to retrieve all users from AD using Microsoft Graph APIs.
https://graph.microsoft.com/v1.0/users
But this is returning only some top n rows from the whole users list.
I guess its using some pagination there. But didn't find how to specify page number or those details as a parameter within the query.
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
Ms Graph cant show all users in the same page as it may cause threshold issues if the user count is too high.
you need to use paging to achieve this i.e., to get all the users you can achieve it with the help of #odata.nextLink please refer Ms Document for more details.

Wild Characters in MS Graph API when fetching all the users info

I'm trying to pull all the users' info from Microsoft Graph, when I do GET https://graph.microsoft.com/beta/users/, it doesn't pull manager, directReports, etc. For that, I'm making additional API calls to
/beta/users/xxxx#xxx.com/directReports and
/users/xxxx#xxx.com/authentication/methods
Is there a way to use wildcard characters in the above, so that it fetches the directReports information for all the users? I don't want to make call for each user and method, as our Org is very big.
You can use the relationships to get these details.
For getting all users directReports you can use the below graph call.
https://graph.microsoft.com/v1.0/users?$expand=directReports
See this document.

Is there any way to get the list of joined teams details of members?

Is there any way to get the list of joined teams details of members except graph API? Using graph API of below link we can get the list of joined teams details of any members. Similarly, is there any other way to get the list of joined MS teams group details? I want to use these details in Microsoft bot framework.
https://learn.microsoft.com/en-us/graph/api/user-list-joinedteams?view=graph-rest-1.0&tabs=csharp
Due to some security concern I can not use graph API as of now.
I am also exploring below link but I am not getting anything here... Looking for any REST API like graph API where I can provide the users name and I can get details.
https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/get-teams-context?tabs=dotnet
It's not a security concern, rather it's part of the requirement. If i am in your place, i would set Graph API as prerequisite for my app to work, explain the benefits that you're going to get with Graph/application permissions. Apart from Microsoft Graph API you can try with Powershell, CLI.

Teams Graph API, Retrieving files from each Teams channel

I am trying to retrieve all of the files associated with each channel within each Team. Per the Microsoft Graph REST API V1.0 documentation, it is GET /teams/{id}/channels/{id}/filesFolder.\
Please see https://learn.microsoft.com/en-us/graph/api/channel-get-filesfolder?view=graph-rest-1.0&tabs=http
However, filesFolder no longer appears as an available query. Is there still a way to achieve this?
Edit: Appears to be the same for Messages. https://learn.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-beta&tabs=csharp&viewFallbackFrom=graph-rest-1.0
Why are these queries no longer available?
You can query Groups with team-id to get the items from the group's drive directly.
You can use https://graph.microsoft.com/v1.0/groups/{team-id}/drive/root/children where /drive/root can get the Document library that the channel folders are part of and /children can display all items from the folder. Referto this doc for more details on how to get a DriveItem.

Microsoft Graph Sharepoint search inconsistent results

I am trying to implement a feature in our app to allow users to search for files in their Sharepoint & OneDrive accounts, as they see in Office365.
I am having trouble understanding why I am not seeing expected results from search API requests.
When I make a search request like this, I get 1 result as expected:
https://graph.microsoft.com/v1.0/sites/{my-site -id}/drive/root/search(q='brisbane')
However, when I search like this, there are no results:
https://graph.microsoft.com/v1.0/me/drive/search(q='brisbane')
If I modify the query for /me/drive/search, I do see results from OneDrive, but not from SharePoint.
According to the Microsoft Graph docs, /me/drive/search should search for 'Items a user can access'.
Is this the expected result? Is there any way to search all the current users' Sharepoint sites? Or do I have to ask the user to configure the sites they would like to search, then search each of them separately?
This is by design. You need to read below the "Searching for items a user can access" heading to understand what this means:
In addition to searching for items within a drive, your app can search more broadly to include items shared with the current user. To broaden the search scope, use the search method on the Drive resource.
When you're searching /me/drive/ you are searching that user's OneDrive for files they have uploaded themselves or have been explicitly shared with them. Files that live within a SharePoint library that a user happens to have access to are quite different than files "shared" with that user.

Resources