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.
Related
I am using Graph API to extract all the incidents and advisories from Microsoft but I encounter some issues, and I will be very happy if you can help me.
I am using the GET Method using the URL
https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues but in the output, I can see that not all incidents are present, and I can see that there is present pagination in the output https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues?$skip=100, can you guys help me how I should filter this to extract all the incidents from the API?
You'll need to make multiple calls until the response provides no further link for you to retrieve further records.
https://learn.microsoft.com/en-us/graph/paging
As is described in the above documentation ...
You can retrieve the next page of results by sending the URL value of the #odata.nextLink property to Microsoft Graph.
As previously stated, once you have reached the last page, you will no longer have a nextLink value to retrieve the next page.
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 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.
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.
I'm developing an iOS application that let the user to search for a person throught the Graph API.
What I want is the SAME behavior that it's present on the Facebook website. You know when you begin to search for a person in the top text input? The first results will be mostly your friends AND some people you MAY know or people you already looked for.
The problem? Try to use the same search pattern here to search a person: Graph Api Explorer
The Graph Api returns DIFFERENT results than the search input on the Facebook website.
Does anyone knows why? Is there a way to achieve the same results?
Facebook are using many algorithms to display search result like Relevance Indicators, Complexities of User-Centric Search and The Product.
One of the algorithm to display result on their page as below.
Personal Context:
Unlike most search engines, every Facebook search involves two key elements - a query and a querier.
Just as we need to understand the query, it’s as essential to understand the person behind the query.
People are more likely to be looking for things located in their own city/country or for people who share the same college/workplace.
We consider this information and much more when ranking results. The more we know about you, the better your search results will be.
In Graph API, they are not using this algorithm.They are just displaying the queried result. Hence you can not achieve same result using graph search API.
To achieve this you can use following apporach -
Get the friend list of user using me/friends?limit=1&offset=1
Get the user list using search api
merge both the result
show result(s) to user
For more information(approach/algorithm) you can check Intro to Facebook Search
Is there a way to achieve the same results? - NO
Does anyone knows why? - NOT REALLY
(Edit: Seems in another answer, someone does actually, but it doesn't change the answer for "If you can achieve it")
But its safe to presume that Facebook does not allow all functionality through the API, why would they after all ? They need to keep the people coming to their own platform. So I can't give you a straight forward response on WHY, but IF ? Not possible, there is zero documentation about more specified search for type user. When you request user friends, you will only get the user friends who are using the same app starting v2.0
Am afraid that you will have to drop the functionality you want to achieve.
It is not just the graph search. When you refresh your TimeLine. The order of posts gets changed every time because Facebook takes a Pull on Demand approach. Which means whenever you login, the data from your friends is fetched. Which is why facebook has a limit to maximum number of friends.
Talking about the Graph search and Graph API. They are not same and the Graph Search cannot be accessed through the Graph API. So, you would have to change your approach.
To explain why the graph search gives different results on same search term. I would guess that it follows the game Pull on Demand model ( although it is not open and we cannot know for sure ). Following that model makes sense though.
Thanks