Problem to generate pdf from docx by Graph API when docx contains repeating content controls

Filip Mateasko 0 Reputation points
2024-09-09T14:07:35.84+00:00

Hi,

we use Graph API to automatically convert generated document (docx) to pdf. The documents are generated by "injecting" custom xml to the template, where the xml with identical structure was bound to content controls. It worked perfectly, but suddenly we have a problem to generate pdf and after hours of investigation I found, that the problem occurs when the docx contains repeating content control. The document has no problem to be open in Word.

Sample request:

https://graph.microsoft.com/v1.0/Drives/[driveId]/root:/General/CV/tmp/[fileName].docx:/Content?format=pdf

response:

{
    "error": {
        "code": "notSupported",
        "message": "Error from Office Service. Url=https://euc.wordcs.officeapps.live.com/document/export/pdf HttpCode=UnsupportedMediaType",
        "innererror": {
            "code": "cannotOpenFile"
        }
    }
}

Could you help us with this, please?

Thanks

Filip

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.