Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Incomplete data after connection with Graph API

Hi 

 

I have managed to retrieve the data from this Graph API request 

 

GET https://graph.microsoft.com/v1.0/users

i got the data but they are not complete at all, i have only one third of my data.

 

could you please tell me how to get the comprehensive data?

 

thanks

1 ACCEPTED SOLUTION
rubayatyasmin
Community Champion
Community Champion

Hi, @Anonymous 

 

This is happening because Graph API from MS returns paginated results. So, to retrieve all pages from the result, you can try M code in PQ

 

for example, 

 

let
GetAllPages = (url as text) as list =>
let
Source = Json.Document(Web.Contents(url)),
data = Source[value],
next = try Source[@odata.nextLink] otherwise null,
output = if next is null then data else List.Combine({data, @GetAllPages(next)})
in
output,
InitialUrl = "https://graph.microsoft.com/v1.0/users",
Data = GetAllPages(InitialUrl)
in
Data

 

Note: Power BI's Power Query component has a limit to the number of recursions it can perform, so if you have a very large number of pages, you may need to adjust the recursion limit in the options.

You would also need to include an 'Authorization' header with your access token in the Web.Contents function, and you'll need to handle any rate limits or other API constraints from the Graph API. As this example stands, it's a very basic example and would need to be expanded to handle a production use case.

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


View solution in original post

1 REPLY 1
rubayatyasmin
Community Champion
Community Champion

Hi, @Anonymous 

 

This is happening because Graph API from MS returns paginated results. So, to retrieve all pages from the result, you can try M code in PQ

 

for example, 

 

let
GetAllPages = (url as text) as list =>
let
Source = Json.Document(Web.Contents(url)),
data = Source[value],
next = try Source[@odata.nextLink] otherwise null,
output = if next is null then data else List.Combine({data, @GetAllPages(next)})
in
output,
InitialUrl = "https://graph.microsoft.com/v1.0/users",
Data = GetAllPages(InitialUrl)
in
Data

 

Note: Power BI's Power Query component has a limit to the number of recursions it can perform, so if you have a very large number of pages, you may need to adjust the recursion limit in the options.

You would also need to include an 'Authorization' header with your access token in the Web.Contents function, and you'll need to handle any rate limits or other API constraints from the Graph API. As this example stands, it's a very basic example and would need to be expanded to handle a production use case.

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors