Fix Microsoft Graph HTTP 400 Error for SharePoint Files With Parentheses
Question details
Developers encounter an HTTP 400 Bad Request error when using the Microsoft Graph API to download SharePoint files with parentheses in the filename.

- Product
- Microsoft Graph API / SharePoint
- Device & OS
- not provided
- Scenario
- Downloading a SharePoint file via Microsoft Graph API where the file path includes special characters like parentheses.
- Observed behavior
- The request returns an HTTP 400 Bad Request error for filenames like 'Test(1).pdf', but succeeds when the parentheses are removed.
Verify that your application has the correct Microsoft Graph API permissions to read SharePoint drive items and that the endpoint URL syntax is otherwise accurate.
URL-Encode the File Path or Use DriveItem ID
The most reliable way to handle special characters in Microsoft Graph API requests is to ensure proper URL encoding or query the file by its unique DriveItem ID instead of its path.
When constructing a Microsoft Graph API request using a file path, special characters like parentheses must be properly URL-encoded. Alternatively, using the file's DriveItem ID avoids path encoding issues entirely.
Update your code to safely URL-encode the file name (e.g., changing 'Test(1).pdf' to its proper percent-encoded format) before appending it to the Graph API endpoint.
If path encoding continues to fail, retrieve the file's DriveItem ID first, then construct your download request using the ID endpoint: /drives/{drive-id}/items/{item-id}/content

Open a Microsoft 365 Support Request
If URL encoding and ID-based requests still result in a 400 error, there may be tenant-specific API issues requiring administrator intervention.
Try WPS Office for Seamless Document Management
While troubleshooting complex SharePoint API integrations, consider using WPS Office for your daily document tasks. It is a lightweight, fully-featured office suite offering excellent compatibility with Microsoft Office file formats and easy document sharing.
- 1. Download the software: Visit the official WPS Office website to download the free installation package for your operating system.
- 2. Install WPS Office: Run the downloaded installer and follow the simple on-screen instructions to complete the setup.
- 3. Open your files: Launch WPS Office and easily open your existing Microsoft Office documents without formatting loss.

Frequently Asked Questions
Why do parentheses in SharePoint filenames cause HTTP 400 errors in Microsoft Graph?
Parentheses are considered special characters in URLs. If they are not properly percent-encoded in the API request path, the Microsoft Graph API cannot parse the endpoint correctly, resulting in a Bad Request (HTTP 400) error.
How do I download a SharePoint file via Microsoft Graph without using its path?
You can download a file using its unique DriveItem ID. Use the endpoint format 'GET /drives/{drive-id}/items/{item-id}/content' to bypass any file path or filename encoding issues completely.
Does renaming the file in SharePoint fix the Graph API error permanently?
While renaming the file to remove special characters (like parentheses) resolves the immediate error for that specific file, the best long-term solution is to update your application's code to properly encode file paths or use item IDs, ensuring all future files are handled correctly.




