Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to get the count and size of attachment in sharepoint list

I would like to get the average number of attachment per list item (on a SharePoint online list).

Here is some sample data

 

Id,AttachmentFiles.ServerRelativeUrl
2,
5,
1,/Attachments/1/1.xlsx
1,/Attachments/1/2.zip
3,/Attachments/3/4.jpg
6,/Attachments/6/2.jpg
6,/Attachments/6/3.pdf
7,/Attachments/7/4.jpg
7,/Attachments/7/5.jpg
7,/Attachments/7/7.jpg

 

I want to get a result table like this:

Attachment per itemCount 
02 
11 
22 
31 

 

How can I do it?

Also is it possible to get the file size of SharePoint online from Power BI?

2 REPLIES 2
lbendlin
Super User
Super User

First this:  Why you should never attach documents in a SharePoint list - SharePoint Maven

 

With that out of the way, you will need to call the Sharepoint API with ODATA queries to retrieve this information

 

Get All Attachments From List Item in SharePoint using REST API - Code SharePoint

 

Anonymous
Not applicable

I think Content Editor webpart is no longer supported? 

Since I don't have permission to develop PowerShell script or SPfx, it seems there is no other way to check the attachment size.

 

I agree attachment is not good. It is why I want to make a statistic report and asking user to move.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.