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.

2 Answers 2

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);
                 }
    });            
} 
1
  • 1
    Yes, I tried HEAD request but server responds with HTTP 501. I consider SOAP instead.
    – andrii
    Commented Mar 26, 2015 at 14:35
-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.

3
  • Please add substantial part of the post in your answer to save it for future use. Commented Mar 23, 2015 at 5:24
  • 2
    Please don’t add just a link as answer to a question. If the link breaks, the answer you provided will not be useful for future visitors. Provide an answer of your own and use the link as reference. If needed, you can block quote the content from your link. More information is found in our help center, especially How do I write a good answer
    – Benny Skogberg
    Commented Mar 23, 2015 at 7:01
  • 2
    Please read my question carefully! I need SP 2010 (_vti_bin/ListData.svc) and GET file size
    – andrii
    Commented Mar 24, 2015 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.