Forum Discussion

grant_jenkins's avatar
grant_jenkins
Iron Contributor
Jul 10, 2019

View Formatting - JSON - Not able to get attachments in list

Hi,

 

I'm using JSON to customize my list, and trying to get the values from my Attachments in the list, but not working as expected.

 

In the following URL: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#foreach it states the following: "The field used in the loop must be in a supported field type with multi-value option enabled: Person, Lookup, and Choice.".

 

So not sure if the attachments is just not an option using JSON and Column/View Formatting?

 

I've tried to get the length of the Attachments field, but always comes back with 0, even though there are attachments. I've also ensured that the Attachments column is part of the view.

 

Looked through numerous examples on the web, but can't find any reference to attachments.

 

This is a show stopper for a project we are currently working on, so hopefully there's a solution :)

 

Some of the sites I've already looked through (and a bunch more not listed)

https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/Building-immersive-user-experiences-with-SharePoint-view/ba-p/245868

https://jeffangama.wordpress.com/2018/09/09/sharepoint-view-formatting-options/

https://jeffangama.wordpress.com/2017/12/03/sharepoint-online-column-formatting-options/

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-formatting

 

Thanks,

 

Grant.

8 Replies

  • yhlow72's avatar
    yhlow72
    Copper Contributor
    Hi, please help to vote the idea your brought up to make Microsoft work harder for us. Thanks https://feedbackportal.microsoft.com/feedback/idea/c290f4f2-46cf-ec11-a81b-000d3a00c008
  • kmktnn's avatar
    kmktnn
    Iron Contributor

    I'm also exploring attachements in lists. I find out that [$Attachments] is a boolean that displays 0 if there are no attachements and 1 if there are some.

    • kmktnn Yup, the Attachments field returns "1" or "0". It will not be possible to get the length for the number of attachments.

    • grant_jenkins's avatar
      grant_jenkins
      Iron Contributor

      Maruthi Gadde

       

      Thanks for your reply. Would be good for someone from Microsoft to confirm this. Really hard to find information about what's supported and what's not.

       

      If we can't do this, then will have to re-think our current solution. Feels like we are continuously doing this with the Office 365 suite - get 90% of the way there only to find out that something can't be done which means re-engineering the solution :(

       

      Not complaining - understand that a lot of the apps/services are fairly new and maturing, just a bit frustrating at times :)

       

      Cheers,

       

      Grant.

Resources