How to insert contextual images into your emails

With Shared Email Templates for Outlook

With Shared Email Templates for Outlook, you're just a few mouse clicks away from adding an image to the message body. All you need do is select one of the three available options—Insert Picture from URL, Insert Picture from OneDrive, or Insert Picture from SharePoint—when creating or editing your template and then specify what image you'd like to embed into an email message. The ~%InsertPicture macro will do the trick making the desired image show up in the message body each time you paste the corresponding template. You can learn more by visiting this help page: How to insert pictures into your templates.

But what if you're not happy with a single image? What if you'd rather have a few alternatives to choose from when inserting your template? Is it a problem? Definitely not ;)

Suppose you want to send a seminar reminder that will contain a picture relevant to the seminar topic. The pictures you're going to use are stored on OneDrive. To create a list of options to choose from, you'll need a simple dataset and two macros: ~%InsertPicture and ~%WhatToEnter. Here are the steps to follow.

  1. Create a simple dataset with two columns containing seminar titles and image file names:
    An example of a simple dataset

    Note. The name of each image must be followed by the file name extension.

    Note. All the images that are going to be used must be in the same OneDrive folder.

  2. In your template, select a place for the picture to be added by placing the cursor there, and then click Insert macro:
    Start inserting a macro.
  3. Select Insert Picture from OneDrive:
    Insert Picture from OneDrive
  4. Select any image you'd like to use and copy the path of that image by clicking Copy link. Then click Select:
    Copy a link to the image.
  5. Proceed with adding the image you've selected by clicking Insert:
    Insert the image.
  6. Right-click the ~%InsertPicture macro placeholder and select Edit Macro Text:
    Start editing the macro text.
  7. Manually select and delete the "fileName", "driveId", and "fileId" parameters:
    The fileName, driveId, and fileId parameters
  8. Instead of the "fileName", "driveId", and "fileId" parameters you've just deleted, insert the "filePath" parameter, along with the copied path of the image inside double quotation marks:
    The filePath parameter

    Then click Save.

  9. Temporarily add the ~%WhatToEnter macro to your template specifying the created dataset and the column containing the image file names in the macro dialog:
    The ~%WhatToEnter macro dialog
  10. Copy the ~%WhatToEnter macro text to the clipboard:
    Copy Macro Text to Clipboard
  11. Right-click the ~%InsertPicture macro placeholder to start editing the macro text and replace the image file name, along with the file name extension, with the copied ~%WhatToEnter macro text in the "filePath" parameter:
    The nested ~%WhatToEnter macro

    When you're done, click Save.

  12. Delete the ~%WhatToEnter macro you added temporarily in Step 9. Then save your changes.

From now on, when pasting your template into an email message, you'll be able to insert a topic image by selecting the seminar title associated with it:
Decide what image to insert.

The result will be as follows:
An image in the message body

If you select another topic when pasting the template, the image will change too:
A different image in the message body

See also

Inserting a picture from preselected OneDrive folders

Post a comment

Seen by everyone, do not publish license keys and sensitive personal info!

If you have any questions or issues with this add-in, please feel free to post your concerns in the comments area. As soon as we answer, a notification message will be sent to your e-mail. If you do not want to share your thoughts in public, please contact us at