Newsletter submission app, with attachment support

When I took over coordination of our e-newsletter several years ago the first thing I did was change how people submitted articles, making it more in line with the corporate equivalent. I decided to utilise the Qualtrics survey system as it wasn’t going to cost me anything, whereas using Survey Monkey would have, and I could use branching to control the questions they would be shown based upon selections made.

Whilst this has generally worked well, output from submissions isn’t the best and there’s no way to support formatting of content, which can sometimes be useful when submitting articles. Enter PowerApps.

I created a three screen app, screen one presents a visually appealing introduction advising users what we accept and reflects the current visual of the newsletter. Screen two is our submission form, implemented using a PowerApps form connected to a SharePoint list. Screen three provides feedback their submission has been successful and allows them to submit an additional article, if required.

The form note allows rich text article submission and to specify more richly event details, such as start and end dates and times. As the SharePoint list isn’t accessible by all members of the newsletter team I needed to be able send all details of the submission, including attachments, in an email to our email address, here I initially hit a stumbling block.

Yesterday, I managed to locate the required steps to support my needs, the process coming down to:

  • When a new item is created
  • Initialise a variable – AttachmentArray (type: array)
  • Get attachments – linking ID to step 1
  • Apply to Each – The output (Body) from Get attachments
    • Get attachment content – Id (ID) from step 1; file identifier (Id) from Get attachments
    • Append To Array Variable
      • Name: AttachmentArray
      • Value: { “Name”: @{items(‘Apply_to_each’)?[‘DisplayName’]}, “ContentBytes”: @{base64(body(‘Get_attachment_content’))}}
  • Send an Email from a shared inbox
    • Attachments: AttachmentArray

The use of base64 ended up being the clincher, I’d tried other people’s suggestions but nothing worked. Oddly enough, the error associated with not using base64 returned was related to subject and person fields. I’m on my iPad so don’t have the original Microsoft mvp link to share just now that helped resolve my issue, his code above; so grateful!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.