web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Converting Macro Enabl...
Power Automate
Unanswered

Converting Macro Enabled Word doc (.docm) file to PDF

(0) ShareShare
ReportReport
Posted on by 2

Hello,

 

I have been able to convert regular word (.doc and .docx) file to pdf using the onedrive for Business - convert file option. However, I am running into issue with converting a docm file. Looking through following documentation, the file format is not supported. However, I was wondering if anyone has found a workaround.

 

https://docs.microsoft.com/en-us/connectors/onedriveforbusiness/#convert-file-(preview)

https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get_content_format?view=odsp-graph-online

 

Thank You

Categories:
I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    Hi @powerautomate5 

     

    Haven't tried it but just some ideas

    Using OneDrive for business for both these options-

     

    option 1: 

    - Get file content (of the docm file)

    - Create file (using the above content). Give Test.docx in the file name

     

    option 2: 

    - Copy file using Path

    in the Destination File Path give Test.docx

    If the docx comes out to be correct then you already have got it to converting to pdf.

     

    Make sure to make backup copies before trying this as it may cause possible data loss.

    Open the new docx file in the browser as well as on the desktop Word app to see if everything looks fine.

  • powerautomate5 Profile Picture
    2 on at

    Option 1:

    powerautomate5_0-1635946625316.png

     

    Error:

    Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=UnsupportedMediaType cert=subject:;thumbprint: ResponseHeaders=X-ErrorCode: WordDocumentHasMetroMEContentNonMetroMEExtension
    X-ClientCorrelationId: 4e619cbb-47f2-488b-b7e0-1d9090ac69a4
    X-ServiceCorrelationId: 4e619cbb-47f2-488b-b7e0-1d9090ac69a4
    X-ErrorCategory: NotSupported
    X-IsRetriable: False
    X-ConversionTimeInMs: 156.2541
    X-FileDownloadTimeInMs: 531.2618
    Cache-Control: private
    Date: Wed, 03 Nov 2021 13:36:13 GMT
    Server: Microsoft-IIS/10.0
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET

     

    I get the same error with option 2.

     

    I have also tried converting the file content to base64 and changing the content type to word, and see if it would lose the macros. No dice. 

    powerautomate5_1-1635947600759.png

     

    Error: 

    Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=UnsupportedMediaType cert=subject:;thumbprint: ResponseHeaders=X-ErrorCode: WordDocumentHasMetroMEContentNonMetroMEExtension
    X-ClientCorrelationId: cfc50925-bf6c-4b05-ad0e-eefad42f065f
    X-ServiceCorrelationId: cfc50925-bf6c-4b05-ad0e-eefad42f065f
    X-ErrorCategory: NotSupported
    X-IsRetriable: False
    X-ConversionTimeInMs: 156.2542
    X-FileDownloadTimeInMs: 453.1315
    Cache-Control: private
    Date: Wed, 03 Nov 2021 13:53:38 GMT
    Server: Microsoft-IIS/10.0
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
  • VJR Profile Picture
    7,635 on at

    Hi @powerautomate5 

     

    I was able to successfully run both the options.

    But my files were very simple ones with one liner text contained in them.

     

    In option 1, I am not using the Convert file. Just "Get file content" and "Create file" were enough to create the docx file.

     

    In option 2, I have simply used one action "Copy file using Path" and in the Destination File Path gave Test.docx

     

    Both the options gave me docx files.

    However, there is a caveat to both these options.

    They both did create the docx files on OneDrive. I was able to open and see the contents when opened in Word online itself. But the contents were not visible when opened in the desktop app.

     

    You can try them out and see if that is workable for you.

    These are not actual conversion methods so not recommended options.

    Just thought of giving some inputs since there is nothing in-built as of now.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard