I would like to pass to Sharepoint>Create file, a variable of type Object to the File Content param

Microsoft
  1. In my flow, depending various conditions I am using distinct templates to create a word document, using "Populate a Microsoft Word template".
  2. For each case, I store the created file in a variable of type Object
  3. Later in my flow, once I handled the different scenarios, I want to save the file to Sharepoint (and also send it by email), by passing the created variable containing the file.

    Unfortunately, the variable of type Object does not seem to be supported to save the file to Sharepoint (nor to send an email).
6 Replies

Hi @Fabrice Frachon 

 

Can you show a sample of your Flow please? If you can show an example how you use the MS Word template connector and how you are saving it, we can use that to track down the issue.

 

Cheers

Damien

Thanks for reaching out @Damien Rosario 

 

1. Initialize variable
Name: wordDocument
Type: Object
Value:

 

2. Populate a Microsoft Word template (preview)

 

3. Set variable
Name: wordDocument
Value: Microsoft Word Document (from step #2)

 

4. Create file (Sharepoint)
File Content: I cannot use the 'wordDocument' variable. I can only pass 'Microsoft Word Document' from step 2

Hi @Fabrice Frachon 

 

Hopefully I understand the issue. Maybe try checking these items?

 

1. Have you put the text fields into Word template where the inserted text needs to go? Have you named each box appropriately?

 

The custom box names should appear in Populate a Microsoft Word template In MS Flow.

 

capture20190628164225119.png

 

2. Have you then inserted values (e.g. your variables) into these boxes in MS Flow?

 

3. When you Create file, the output has to be 'Microsoft Word Document' from the Populate a Microsoft Word template as that has the variables you have added in (1).

 

Here's a diagram that I hope illustrates the point in Flow.

 

You can insert your variables into the Populate a MS Word template fields aboveYou can insert your variables into the Populate a MS Word template fields above

Hope that helps?

 

Cheers

Damien

 

EDIT: P.S. I should add that I do not believe the variables will be recognised as appropriate file content thus the issue. You'll need the variables to be input into the Populate a Microsoft Word template connector before creating the file.

My issue is not with creating Word documents using templates. I am able to create and save Word documents and using variables to populate the template.

 

What I cannot do, is use the Word document that I placed in a Microsoft Flow variable, as an input later in my flow to save the File or to attach to an email (again my scenario is that the Microsoft flow variable is used to support that, depending conditions, the Word document is different).

OK maybe try using Compose and using the Set initialize variable output as the source. Then use the compose box output as the file content.

@Fabrice Frachon@Damien Rosario is correct. It should look like this:

 

  1. Initialize variable of type object
  2. Use a Switch control to run the right Populate a Microsoft Word Template action
  3. Set the variable of type object to the output of the Populate a Microsoft Word Template in each switch case
  4. After the switch control, add a Compose action with the input of your variable of type object
  5. Use the Create File SharePoint action and add the output of the Compose action as the File Content.

If you don't add the Compose action in step 4, the file will become corrupt when the Create File in SharePoint action is completed.