cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HiroakiSasaki
Helper I
Helper I

Lookup an item from SharePoint list and show its attachments on attachment control on form as default

Hi, 

 

What I want goes as below.

 

1) Using lookup, get an item from SharePoint list, which may have single or multiple attachments.

2) get the attachment(s) and set it in a variable

3) show it on attachment control on form, using the variable

 

In my scenario, I'm not using Gallery, so I cannot use ThisItem.

Using ThisItem, I know we can get attachment like this: ThisItem.'{Attachments}'

 

But in my case, users will open the form screen directly from a link with parameter ID of the item (the link is distributed via email).

So, I'm looking up an item by the parameter ID, but can't get `{Attachments}'

 

I'm writing like this:  Lookup([SPlist], ID=[ParameterID]).XXX

 

But I do not see the option '{Attachments}' to replace XXX.

 

It seems there is some difference between data lookup gets and data ThisItem holds.

Any ideas?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @HiroakiSasaki ,

Firstly you cannot save an attachment as a Variable. You can display attachments from another list in a gallery with

LookUp(
   OtherList,
   ID = YourIDParameter
).Attachments

and then the name and (if an image file) the image in this gallery.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @HiroakiSasaki ,

Firstly you cannot save an attachment as a Variable. You can display attachments from another list in a gallery with

LookUp(
   OtherList,
   ID = YourIDParameter
).Attachments

and then the name and (if an image file) the image in this gallery.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Hi, @WarrenBelz !

Thank you for sharing knowledge!

As you wrote, if I designate the gallery control, which has the target SharePoint List as items source, I successfully get the attachment.

LookUp(Gallery.AllItems,ID=Param("ID")).Attachment

 

 But I don't get what you mean by saying you cannot save an attachment as a Variable.

Set(varAttachment,LookUp(GalInquiry.AllItems,ID=Param("ID")).Attachment)

After executing the function above, I got below result. Doesn't it mean I saved the attachments in a table-type variable?

HiroakiSasaki_0-1644480005502.png

 

Hi @HiroakiSasaki ,

Sort of - you did not save the actual file however - only the references to it (you cannot download it as you would from an attachment control)

HiroakiSasaki
Helper I
Helper I

@WarrenBelz 

 

I got it. Thank you for your reply. My issue is now solved!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,087)