Forum Discussion
Faster mail load from Exchange
- 11 months ago
You may want to look into querying your mail messages via Graph API.
Some caveats:
- I have not used this directly in a while, so just going off memory / quick research / testing with Graph Explorer sample tenant.
- Graph integration with PBI is quite limited. Last I checked, though, you could still connect to personal mail through simple http calls and using PBI oauth. See MS party line on this: https://learn.microsoft.com/en-us/power-query/connecting-to-graph
- For a more enterprise solution, you may want to look into the MS recommended route of Graph Data Connect through Data Factory
Connecting would look something like this:
Web.Contents( "https://graph.microsoft.com/v1.0", [ // can query me/mailFolders and nav via childFolders; eg me/mailFolders/<id>/childFolders/<id>/messages RelativePath = "me/mailFolders/inbox/messages", Headers = [ accept = "application/json" ], Query = [ #"$orderby" = "sentDateTime desc", // props list for select: https://learn.microsoft.com/en-us/graph/api/resources/message#properties #"$select" = "id,sentDateTime,from,subject,bodyPreview", // eg filter to this year; datetime format is ISO 8601 (eg 2025-01-01T00:00:00Z) #"$filter" = "sentDateTime ge 2025-01-01", #"$top" = "100" // I believe max is 1000 - adjust as needed for performance ] ] )Parse the response as JSON (Json.Document). You'll get a JSON record with fields:
- value: list of records to upack with Table.FromRecords
- @odataNextLink: if more records exist than specified in $top, this will give the REST url for next page of size $top
Hi anrm6,
Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to MarkLaf & Royel for sharing valuable insights.
Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.
Thank you for being part of the Microsoft Fabric Community.
- anrm610 months agoNew Member
Havent been able to figure out a faster way tbh. I am not a technical person so unsure of how the API thing works
- v-ssriganesh10 months agoCommunity Support
Hello anrm6,
The suggestions using your existing StartDateParam and the Graph API are great options, but I understand the API might feel overwhelming. Sticking with Power Query, you can improve performance by archiving older emails into a .PST file via Outlook to reduce your live mailbox size, then reconnecting to it. Alternatively, if you're in Power BI, try setting up incremental refresh with your StartDateParam to load only new data after the initial run. Test these and let me know how it goes.
Best regards,
Ganesh Singamshetty.- v-ssriganesh10 months agoCommunity Support
Hello anrm6,
I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.
Thank you.