Search code examples
sharepoint-onlinepower-automateword-template

Adding SharePoint Image field in Word template


I'm trying to build a Word doc generator. Data is held in a SharePoint list (text, person info, images), and is then inserted into a Word template via Power Automate. There will be many entries in the list, all with unique data and images.

The Image fields are native SP Image columns, not hyperlinks. They will be uploaded each time the form is completed.

The problems I'm having are:

  1. While the text fields show up on Quick Parts, none of the Image fields do, so I can't insert them.

  2. I can manually add picture controls to the Word template, but in Power Automate, the Image fields aren't shown in Dynamic Content even though "Populate a Microsoft Word template" shows the Picture content controls.

Does anyone know why they don't show, and how I can get the Image fields to be added to the Word doc? Or, am I doing it the wrong way, and I should use attachments - in which case, how do I do that for multiple attached images?


Solution

  • Try as following to retrieve a single item's Image column value in Power Automate:

    1.Send an HTTP request to SharePoint (where Image is internal name of Image column):

    enter image description here

    enter image description here

    2.Initialize a variable with an expression that gets the fileName of the image:

    Name:  ImageName
    Type:  String   
    Value:  json(body('Send_an_HTTP_request_to_SharePoint')?['d']['Image'])['fileName']
    

    3.Get file content using path: enter image description here enter image description here

    4.Populate a Microsoft word template use the file content: enter image description here

    Result for your reference:

    enter image description here

    Similar issue for your reference:

    https://sharepoint.stackexchange.com/questions/296641/performing-a-get-items-action-on-a-list-with-an-image-column-causes-error