An API that connects multiple Microsoft services, enabling data access and automation across platforms
Hello there,
Welcome to Microsoft Q&A Azure
At the moment, Microsoft Graph API does not support direct conversion of .docm (Word macro-enabled) files to .pdf. This is expected behavior, as the file conversion endpoint (/drive/items/{item-id}/content?format=pdf) only supports standard Word formats such as .docx. You can find the documentation here: Microsoft Graph API – DriveItem: Content
The technical reason is that .docm files contain VBA macros, which can pose security risks and are not processed by Microsoft 365 cloud-based services. Therefore, the API intentionally blocks direct conversion of these files.
As a workaround, you can:
Save or convert the file to .docx before submitting it to the Graph API — this can be done in Word desktop, via Power Automate, or programmatically using Microsoft Graph or Office Scripts.
If retaining macros is required, perform the conversion locally using Word Interop or Office Scripts in Excel Online, which allow more control over macro-enabled content.
Currently, there is no public roadmap indicating future support for .docm conversion in Graph API. You can stay updated by following: Microsoft Graph changelog and submit a feature request here: Microsoft Graph Feedback Portal