It is possible to read the storage Volume of a site collection with JavaScript?

  • For which version of SharePoint do you require this? – Dikesh Gandhi Apr 12 '19 at 10:00
  • Sharepoint 2013 onPrem – cvb Apr 12 '19 at 10:23

Please try below code after attaching jQuery library on page.

        url: _spPageContextInfo.siteAbsoluteUrl + "/_api/site/usage",
        type: "GET",               
        headers: {
            "Accept": "application/json;odata=verbose",
        success: function (data) {
             var percent = data.d.Usage.StoragePercentageUsed;
             percent = 100*percent;
             percent = percent;
             var storage = data.d.Usage.Storage;
             storage = storage/1073741824;
             storage = storage;
             alert("Total storage: "+((storage*100)/percent).toFixed(2)+"GB"); 
             alert("Storage used: "+storage.toFixed(2)+"GB");   
        error: function (data) {



P.S.: It will only show proper value if you have set "Quota Template" during site collection creation.

Hope this will help you.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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