Office 365 Attachments Open in Online Apps

6 5 3,651

So, I recently realized that Nintex Forms caused attachments to download rather than open in Word/Excel Online regardless of the setting you have in the site collection. We had some users for which this wasn't acceptable. We toyed with the idea of giving them a document library and having them upload things there and then just link to them, but I really wanted to make this work more intuitively so I came up with this workaround.

I took most of my workflow inspiration from Attachment links in 'Send e-mail'  by Rasmus Nielsen which was based on this SlideShare from Alan Richards. I made a few tweaks and then had to figure out how to nicely display it on the Nintex Form.

On my list I created a Hyperlink Column for each Attachment "slot" essentially. I built my workflow to accomodate up to 4 attachments, so I added 4 Hyperlink fields, named Link to Attachments, Attachments2, Attachments3, Attachments4.

Now, onto the workflow, first, these are all the variables I used:

And then, here's the workflow! If you have trouble reading the text, you can open the image in a new tab and zoom in further.

NOTE: This workflow does not account for the possibility of non-office attachments (png, jpg, pdf, etc). You could easily add a conditional to check the filename and see if it doesn't contain one of the office extensions and drop the ?web=1 off of the link if it's not an Office extension.

Ok, so what does the form look like now?

How did we get that?

Well, we still want the users to use the native Attachments control to upload and delete attachments, which means they need to see that on Edit and New, but we want them to only see our "nice" Office Online links for when they're viewing so they don't get confused and click the wrong one.

To get the URLs to stack closely like that, we had to basically overlay them on the form like so:

Then we have a rule on the panel surrounding "Link to attachments" that looks like this:

So we're saying "if it's NOT display mode (ex it's edit or new), then hide these controls." Conversely, on the native attachments control, we have:

Meaning, if we're in "Display" mode, we want to hide this native attachments control.