cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Super User
Super User

Attachment control, make documents open directly in word/excel

Hi 

 

I have a power apps that displays the attached files from a SharePoint item in an attachment control. Each time i click the attached file it downloads it to the local computer.

 

I would like for it to open directly in word if it is a word document, and for excel directly in excel and so on.

I would also like the ability to edit the file and just click save and it writes back to the SharePoint item without having to download and then attach the updated word file and then save.

 

The above works in the SharePoint list form.

- I open the item, click on the attachment, if it is a word file it opens directly in word and I'm able to edit the file and just click save.

 

Is it possible to achieve in power app using the attachment control?

8 REPLIES 8
JayMagness
Solution Specialist
Solution Specialist

HI,

 

I would put a button above the attachments or next to them then use Launch("Path") to have the system call the URL or the attachment in SharePoint and launch it there.

 

Remember PowerApps in this case is just lipstick to SharePoint. Nothing is in PowerApps all files and data are in SharePoint.

 

If you want send me an Email and I will setup a teams meeting to help you jay@research-nest.com

@JayMagness Thank you for answering but that solution would mean i need to check how many attachment i have show a button for each attachment, get the uri for each of the attachment map it to the button next to it.

 

Will try it out but i would prefer not having to have multiple buttons but just using the attachment control

 

When using AttachmentControl i do not have the option to use URL.

I have AbsoluteUri, DisplayName, Id, Value i cannot use those with the Launch command.

 

I fail to see how i would set this up with launch for multiple attachments and only display the button connected to the correct attachment.

If i use a gallery instead of an attachment control and OnSelect = Launch(Concatenate(ThisItem.AbsoluteUri,"?web=1"))

This seems to allow me to open the word/excel file in a new webbrowser allowing me to edit it.

v-qiaqi-msft
Community Support
Community Support

Hi@JimmyWork,

Based on the issue that you mentioned, do you want to open the attached file directly in PowerApps?

Combine that with the formula you provided, Launch() will get the full path of the attachment and concatenate the string "?web=1" to open it in a new browser tab. 

I’m afraid that there is no way for you to achieve this currently in PowerApps. You can’t directly open the word/excel file in the PowerApps. There is PDF Viewer control / Image control available within PowerApps to display the corresponding file, but for the word/excel file, there is no way to display within PowerApps.

Here is a similar idea you can vote: https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Word-Office-documents-viewer-control-in-PowerAp...

Further, for attachments, currently, it is only available to download, there are no methods to Preview the attachments directly within PowerApps.

You may consider submitting it as an idea if you would like to preview the files.

 

Best Regards,

Qi

Best Regards,
Qi

@v-qiaqi-msft Thank you for answering

 

I do want it to open in the web browser not inside of the power app. But i would like for the AttchmentControl to open it in the web, but currently i can only do so if i use a gallery to display the attachments?

Hi@JimmyWork,

Allow me to confirm what you're trying to accomplish. You do want to open the attached file in a browser. Actually, I think there is no need to create a URL to locate your attached file in the SharePoint list.

  • Set the OnSelect property of an Icon as below.

 

Launch(First(ThisItem.Attachments).AbsoluteUri)​

 

You can click the Icon which will bring you to the browser to open the file. You can see the operation as the attachment GIF shows.

Test.gif

Best Regards,

Qi

Best Regards,
Qi

@v-qiaqi-msft Thank you again.

 

My questions is how to achieve this in the attachmentcontrol and not in a gallery.

Also i cannot do the 

Launch(First(ThisItem.Attachments).AbsoluteUri)​

Because i use LookUp to get the AbsolutUri and no matter how i try i keept getting errors, nothing opens.

 

Thank you @JimmyWork this did exactly what I have been spending an hour trying to do.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,329)