Forum Discussion
Microsoft Graph API returns 404 when querying SharePoint file by siteId, listId, uniqueId
1. Check if the resource exists
Confirm site/list/file ID
Check the URL in the SharePoint interface to make sure siteId, listId, fileId are correct
Test if the site exists using GET /sites/{site-id}
Check if the file has been deleted/moved
Find it in the SharePoint Recycle Bin
2. Verify permissions
Check for API permissions
Ensure application registration (Azure AD) is authorized Sites.Read.All or Sites.ReadWrite.All
Administrator needs to agree to permissions (https://admin.consent.microsoft.com)
Check user permissions
Ensure user has read permissions to target files/lists
3. Check API request format
Correct format:
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem
Common error:
using list-title instead of list-id (need to be converted)
Incorrect API version (should use v1.0 or beta)
4. Solution
Fix API request
http
GET https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items/{item-id}
drive-id = Document Library ID (can be used with GET /sites/{site-id}/drives/{drive-id}/driveItem}) drive-id = Document Library ID (available as GET /sites/{site-id}/drives)
item-id = Document ID (available as GET /sites/{site-id}/drives/root/children)
5. Check SharePoint Online status
Access Microsoft 365 service status
Verify that the SharePoint Online service is OK
6. Test with Graph Browser
Open Graph Browser
Test API requests after login
7. Advanced Debugging
Check HTTP response header (x-msrequest-id)
Grab packets using Fiddler/Postman
View Azure AD Audit Logs (SignInLogs)