3

Is there a way to get file size with SharePoint 2010 REST (via _vti_bin/ListData.svc) service?
The same question about number of items in some folder.
I don't see such fields in items corresponding to documents.

andrii
  • 369
  • 1
  • 6
  • 23

2 Answers2

1

It does not seem possible to retrieve File Size using SharePoint 2010 REST Interface.

But you could consider to retrieve file size from Content-Length header via HTTP HEAD request (without downloading a file).

JavaScript example:

function getFileSize(fileUrl,success) {
    $.ajax({
        type: "HEAD",
        url: fileUrl,
        success : function(message,text,response){
                    var fileSize = response.getResponseHeader('Content-Length');
                    success(fileSize);
                 }
    });            
} 
Vadim Gremyachev
  • 42,498
  • 3
  • 86
  • 167
-2

You can get file size with REST services in SharePoint 2010.

http://www.shillier.com/archive/2013/03/26/uploading-files-in-sharepoint-2013-using-csom-and-rest.aspx

This link has details of using REST Service to get file size

You need to use code mentioned in above link.

Raghu Ariga
  • 240
  • 2
  • 8