Graph API - problem to generate pdf from document containing repeating content controls

Filip Mateasko 10 Reputation points
2024-09-09T14:12:12.83+00:00

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?

Thank you

Microsoft Security | Microsoft Graph
{count} vote

Your answer

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