Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

The column you specified is not accessible in this context

Posted on by 18
Hi All 
 
I'm facing a problem. 
I'm trying to get attachments of multiple records in a SharePoint list
 
My SharePoint list is named "DocList"
I have a Gallery named DocListGallery that contains 10 records of "DocList" 
 
I want to get Attachments of each of 10 records and store it on a collection named AttachmentsFilesCol 
 
Here's what i've made :
 
 
Clear(AttachmentsFilesCol);;
ForAll(
    DocListGallery.AllItems As Item;
    Collect(
        AttachmentsFilesCol;
        First(Item.Attachments)
    )
)
 
This is not working as i'm receiving an error "The specified column attachments is not accessible on this context"
The First() property is because i autorize only 1 attachment per record  so in my case i can use First. 
 
Thanks for your help because it's annoying :(
  • WarrenBelz Profile Picture
    WarrenBelz 143,297 on at
    The column you specified is not accessible in this context
    Hi @jd38,
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 143,297 on at
    The column you specified is not accessible in this context
    Hi @jd38
    Yes you are correct (my brain not properly engaged at the time). This does not help you however as when List records are collected, the Attachments field is presented as a BLOB (Binary Large Object) reference as below (try to collect a complete list and you will see this)
    and you cannot dissect it further into its individual files (hence the message that the field is not available to do what you need).  When you refer to a single record (as in the code I provided), it sees Attachments as the Table and successfully resolves that field into its components. While what you have could be argued as possibly technically correct, it simply does not work - I have tried a number of iterations without success (getting the same message).
    For instance, this works (as maybe you can do this 10 times)
    Clear(AttachmentsFilesCol);;
    Collect(
       AttachmentsFilesCol;
       First(
          Index(
             DocListGallery.AllItems;
             1
          ).Attachments
       )
    );;
    Collect(
       AttachmentsFilesCol;
       First(
          Index(
             DocListGallery.AllItems;
             2
          ).Attachments
       )
    );;
    Collect(
       AttachmentsFilesCol;
       First(
          Index(
             DocListGallery.AllItems;
             3
          ).Attachments
       )
    )

    however the logical progression using Sequence of the gallery rows
    Clear(AttachmentsFilesCol);;
    ForAll(
       Sequence(
          CountRows(DocListGallery.AllItems);
          Collect(
             AttachmentsFilesCol;
             First(
                Index(
                   DocListGallery.AllItems;
                   Value
                ).Attachments
             )
          )
       )
    )

    immediately gets the same message you are receiving.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • jd38 Profile Picture
    jd38 18 on at
    The column you specified is not accessible in this context
     
    Thanks for your reply. 
    It will not resolve my issue 
     
    Your format permit just to get all the attachments of the first record DocListGallery 
     
    My need is the opposite. I want to get only 1 attachment for all DocListGallery. 
     
    Suppose you have 2 records on DocListGallery like this : 
     
    ID     |    Name         |              Type                 | Attachments
    ------------------------------------------------------------------
    01       LICUsr                  Driving License             Table[LicenceScreenshoot.png]
    -------------------------------------------------------------------
    02       StandX                 Stand location              Table[Stand.png]
     
     
    On those 2 records, i need to get the attachments to show it on a grid
     
     

    In order to get Attachments and store it in a collection.
     
    Clear(AttachmentsFilesCol);;
    ForAll(
        DocListGallery.AllItems As Item;
        Collect(
            AttachmentsFilesCol;
            First(Item.Attachments)
        )
    )
     
    This code is not working. 
     
    I've also tried 
     
    Clear(AttachmentsFilesCol);;
    ForAll(
        DocListGallery.AllItems As Item;
        Collect(
            AttachmentsFilesCol;
            {Attachments : Item.Attachments}
        )
    )
     
    Not working
     
  • Suggested answer
    WarrenBelz Profile Picture
    WarrenBelz 143,297 on at
    The column you specified is not accessible in this context
    Hi @jd38,
    Try this format
    ClearCollect(
       AttachmentsFilesCol;;
       First(DocListGallery).Attachments
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard