web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / How to get SharePoint ...
Power Pages
Unanswered

How to get SharePoint attachment image in collection

(0) ShareShare
ReportReport
Posted on by

Hi Guys, I hope somebody will help me.

 

Can we bind Gallery from collection and show image as well?

Actually I have to create a collection with have SharePoint list data along with attachments and want to show first image on Gallery along with title and other fields.

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Abdul5 ,

     

    Could you tell me:

    1. Do you want to put all the data in your list into the collection?
    2. Do you want to use the gallery control to display the attached images in the collection?

     

    If my assumptions are correct, the point is that the collection cannot directly access the attachments in the list. You could refer to the following steps.

    1. Create a collection "Test". The data in it is all the attachments in the list.
    2. Create a collection "Test2". Firstly, it collects all the data in the list except attachments. Secondly, merge it with the data in Test collection.

     

    I've made a test for your reference:

     

    1\ This is my list LIST4

    v-xiaochen-msft_0-1608101154654.png

     

     

    2\ Add a button control and set its onselect property to:

    ClearCollect(
    
     TheVar,
    
     1
    
    );
    
    ClearCollect(
    
     Test,
    
     {AAA: ""}
    
    );
    
    Clear(Test);
    
    ForAll(
    
     LIST4,
    
     Patch(
    
     Test,
    
     Defaults(Test),
    
     {
    
     AAA: First(
    
     Last(
    
     FirstN(
    
     LIST4,
    
     First(TheVar).Value
    
     )
    
     ).Attachments.Value
    
     ).Value
    
     }
    
     );
    
     Patch(
    
     TheVar,
    
     First(TheVar),
    
     {Value: First(TheVar).Value + 1}
    
     )
    
    )

     

    3\ Add a button control and set its onselect property to:

    ClearCollect(
    
     TheVar2,
    
     1
    
    );
    
    ClearCollect(
    
     Test2,
    
     LIST4,
    
     {Picture: ""}
    
    );
    
    ForAll(
    
     Test2.Title,
    
     Patch(
    
     Test2,
    
     ThisRecord,
    
     {
    
     Picture: Last(
    
     FirstN(
    
     Test,
    
     First(TheVar2).Value
    
     )
    
     ).AAA
    
     }
    
     );
    
     Patch(
    
     TheVar2,
    
     First(TheVar2),
    
     {Value: First(TheVar2).Value + 1}
    
     )
    
    )

     

    4\ Insert a label control into the gallery and set its Text property to:

    ThisItem.Picture

     

    5\ The result is as follows:

    v-xiaochen-msft_1-1608101154655.png

     

     

    Best Regards,

    Wearsky

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Abdul5  ,

    Could you tell me:
    Has the problem been solved?
    Is there anything else I can help?

    Best Regards,
    Wearsky

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 50

#1
11manish Profile Picture

11manish 50

#3
Valantis Profile Picture

Valantis 26

Last 30 days Overall leaderboard