An API that connects multiple Microsoft services, enabling data access and automation across platforms
It sounds like you're encountering a common issue when trying to download the mailbox usage report from the Microsoft Graph Reports API. The 302 redirect indicates that the request was successful and that you are being redirected to a temporary download URL. However, receiving a 404 error when trying to access that URL typically means that the URL is either expired or invalid.
Here are a few steps you can take to troubleshoot and potentially resolve the issue:
- Check the Timing: The preauthenticated download URLs are only valid for a short period of time (a few minutes). Ensure that you are following the redirect immediately after receiving it to avoid expiration.
- Verify the Token: Ensure that the token included in the download URL is still valid. If the token has expired, you will receive a 404 error.
- Permissions: Although you mentioned that the app has the necessary permissions, double-check that the permissions are correctly set and that admin consent has been granted for the Reports.Read.All permission.
- Test with Different Periods: Sometimes, specific periods may not have data available. Try using different periods (e.g., D7, D90, D180) to see if the issue persists across all options.
- Inspect the Redirect URL: Make sure that the redirect URL you are following is exactly as provided in the response and that there are no alterations or issues with how the URL is being handled in your code.
If the problem continues after these checks, consider reaching out to Microsoft support for further assistance, as there may be an issue on their end with the report generation or the download service.
References: