cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Populate a Microsoft Word template not functioning correctly

Hey everyone, quick intro I am a student at the University of Wisconsin and am currently working an internship where I have been focused on trying to integrate Power Automate into the business. I have found it very interesting and am looking forward to increasing my skills in Power Automate and the other programs in the Power suite.

 

For this particular flow I am attempting to have it save AP invoices from emails into a SharePoint document library. These invoices may come as an attachment in an email, or they may simply be in the body of the email. My solution is to create a folder in SharePoint that is titled the subject of the email and then save any attachments and save the body of the email within the folder. I ran into an issue where the body of the email is saved as a txt file in SharePoint, but for some reason my computer still cannot open it when I download it from SharePoint; I have to view it in the downloads folder and choose to open it in word in order to view it which is not good enough for this application. (I have checked system defaults to make sure notepad is set to open txt files and that is true but it still does not open unless I open it from Downloads folder)

 

So, I tried to save the email body to onedrive and convert it to a pdf, but PA currently is unable to convert txt files to any other format.

 

My next solution was to create a Word template with a field to enter the email body and then utilize the Populate a Microsoft Word template step to make a Word doc containing the email body, and then use the create file in SharePoint step to add this Word doc to the email folder in SharePoint. 

 

Now, I am running into an issue where it says that the flow was successfully ran, but the email body file added in the folder is still the txt file and not a Word doc like it needs to be. I have the Word template saved in SharePoint, and I heard there were some issues with using a template saved in SharePoint so I did the same with the template saved in OneDrive but that changed nothing.

 

nzyck_0-1596047308754.png

This is the SharePoint folder after a test run, I have no issues creating a folder or saving the attachment but the email body remains a txt file. Again, the flow is ran successfully without any errors it just still shows up saved as a txt file rather than a Word doc which has me confused.

 

I will put my flow setup here, if anyone has any solutions or other recommendations please let me know!

 

nzyck_1-1596047705330.png

nzyck_2-1596047759016.png

 

Thanks,

Nathan Zyck

nzyck@wisc.edu

 

9 REPLIES 9
Highlighted
Microsoft
Microsoft

Re: Populate a Microsoft Word template not functioning correctly

Hi @nzyck did you check if the "body preview" contains the file extension on the Create File 2? Otherwise, could you please add the .doc extension after the "body preview" 

Highlighted
Frequent Visitor

Re: Populate a Microsoft Word template not functioning correctly

Thank you so much that solved the error of not creating a word document! One issue I still have is it does still enter the body of the email in HTML format like this

nzyck_0-1596464027681.png

Is there any way to fix this so it just enters the text body? Thanks!

Highlighted
Responsive Resident
Responsive Resident

Re: Populate a Microsoft Word template not functioning correctly

I propose another solution.

 

You can create a SharePoint List with Rich text column for Body Content. Then Using Flow, Create a new List Item and throw body as is in that Rich text. It will look pretty nicely formatted. Then add email attachments as list item attachment.

 

Now you have everything together in a list which you can search as well.

Highlighted
Microsoft
Microsoft

Re: Populate a Microsoft Word template not functioning correctly

Hi @nzyck great news. @PrasadAthalye is suggesting a good approach, please try to test it and let us know the results.

Highlighted
Frequent Visitor

Re: Populate a Microsoft Word template not functioning correctly

@danvarga @PrasadAthalye  

 

I made a flow for your solution, and I like it but I am running into an issue where I am unable to open up the saved attachments from the email. I also tested it with an image in the email body, and it saves it as an attachment which is great but I still am unable to open it. Do either of you have any idea why this would happen?

 

nzyck_0-1596565530840.png

when I click on the attachment

nzyck_1-1596565567648.png

 

Same issue with the saved image

nzyck_2-1596565800165.png

This is what appears when I click image001.png which is the image in the email body

nzyck_3-1596565950694.png

Just a black screen with that square in the middle, unable to see image.

 

This is my flow.

nzyck_4-1596566045210.pngnzyck_5-1596566079616.png

 

Thanks!

Highlighted
Responsive Resident
Responsive Resident

Re: Populate a Microsoft Word template not functioning correctly

I found issues with PDFs. PDF has various versions and with unstable internet, file is corrupted. One of my users in Africa always ended up getting PDF attachment corrupted since she started working remotely and on dial up internet.

 

Can you try Word attachment and see if that works? So that Issue can be isolated?

Highlighted
Frequent Visitor

Re: Populate a Microsoft Word template not functioning correctly

@PrasadAthalye 

 

Yes, actually my second test I did with a word doc but did not include it in my screenshots. I ran into a similar error, could not open it. This is what shows up after I open it.

nzyck_0-1596570080537.png

 

Highlighted
Responsive Resident
Responsive Resident

Re: Populate a Microsoft Word template not functioning correctly

I checked your flow. I see that in the File Content Mapping, you have selected Attachments from Outlook. Can you select Attachment Content instead? Should looks something like below...

 

PrasadAthalye_0-1596571088914.png

 

Highlighted
Frequent Visitor

Re: Populate a Microsoft Word template not functioning correctly

@PrasadAthalye 

 

I changed it to attachments content, and now PDF attachments work but Word documents do not. I get the same error message for Word documents as I did before. PDF attachments do work now with the attachments content method now though.

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,198)