SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.23k stars 991 forks source link

Not getting size/Length for Document library folders in SharePoint rest APIs #8791

Open akanshi-crest opened 1 year ago

akanshi-crest commented 1 year ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

πŸ’₯ SharePoint Framework

Developer environment

Linux

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

Api for fetching documents library details not returning the size of folder in SharePoint rest api. I am tryin to hit this API endpoint: https://3hmnr2.sharepoint.com/sites/enterprise/site1/_api/web/lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/items?$select=Modified,Id,GUID,File,Folder&$expand=File,Folder. But in response It should provide the size of folder as same as it returns for files. Sharing the API response to understand the issue better. { 'odata.metadata': 'https://3hmnr2.sharepoint.com/sites/enterprise/site1/_api/$metadata#SP.ListData.SiteAssetsItems&$select=Modified,Id,GUID,File,Folder', 'value': [{ 'odata.type': 'SP.Data.SiteAssetsItem', 'odata.id': '529f040a-ade4-41c9-8f7f-63500f966da4', 'odata.etag': '\'1\'', 'odata.editLink': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(1)', 'File@odata.navigationLinkUrl': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(1)/File', 'Folder@odata.navigationLinkUrl': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(1)/Folder', 'Folder': { 'odata.type': 'SP.Folder', 'odata.id': 'https://3hmnr2.sharepoint.com/sites/enterprise/site1/_api/Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(1)/Folder', 'odata.editLink': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(1)/Folder', 'Exists': true, 'IsWOPIEnabled': true, 'ItemCount': 2, 'Name': 'site1 Notebook', 'ProgID': 'OneNote.Notebook', 'ServerRelativeUrl': '/sites/enterprise/site1/SiteAssets/site1 Notebook', 'TimeCreated': '2023-01-31T12:24:54Z', 'TimeLastModified': '2023-02-23T06:16:17Z', 'UniqueId': '91c9ddc6-73d2-461d-9fff-b9dabe41b028', 'WelcomePage': '' }, 'Id': 1, 'ID': 1, 'Modified': '2023-01-31T12:24:55Z', 'GUID': '7dface67-cb93-44bf-80df-900cb773d81a' }, { 'odata.type': 'SP.Data.SiteAssetsItem', 'odata.id': 'c3cc132b-fcbd-48af-8ecf-9c749d0e0c3f', 'odata.etag': '\'9\'', 'odata.editLink': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(2)', 'File@odata.navigationLinkUrl': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(2)/File', 'File': { 'odata.type': 'SP.File', 'odata.id': 'https://3hmnr2.sharepoint.com/sites/enterprise/site1/_api/Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(2)/File', 'odata.editLink': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(2)/File', 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{3A3EA1B3-FD71-4508-9C69-0C7E785C71BF},9,9', 'CustomizedPageStatus': 0, 'ETag': '\'{3A3EA1B3-FD71-4508-9C69-0C7E785C71BF},9\'', 'Exists': true, 'IrmEnabled': false, 'Length': '14544', 'Level': 1, 'LinkingUri': 'https://3hmnr2.sharepoint.com/sites/enterprise/site1/SiteAssets/site1%20Notebook/Untitled%20Section.one?d=w3a3ea1b3fd7145089c690c7e785c71bf', 'LinkingUrl': 'https://3hmnr2.sharepoint.com/sites/enterprise/site1/SiteAssets/site1 Notebook/Untitled Section.one?d=w3a3ea1b3fd7145089c690c7e785c71bf', 'MajorVersion': 1, 'MinorVersion': 0, 'Name': 'Untitled Section.one', 'ServerRelativeUrl': '/sites/enterprise/site1/SiteAssets/site1 Notebook/Untitled Section.one', 'TimeCreated': '2023-02-23T06:16:11Z', 'TimeLastModified': '2023-02-23T07:14:19Z', 'Title': null, 'UIVersion': 512, 'UIVersionLabel': '1.0', 'UniqueId': '3a3ea1b3-fd71-4508-9c69-0c7e785c71bf' }, 'Folder@odata.navigationLinkUrl': 'Web/Lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/Items(2)/Folder', 'Id': 2, 'ID': 2, 'Modified': '2023-02-23T07:14:19Z', 'GUID': '7fd58df7-eb1e-4fd2-9424-55fa8f61a537' } ] }

Steps to reproduce

  1. Try to hit the endpoint "https://3hmnr2.sharepoint.com/sites/enterprise/site1/_api/web/lists(guid'776da87b-4fc0-4dbd-8a15-5d09d8f93acc')/items?$select=Modified,Id,GUID,File,Folder&$expand=File,Folder"
  2. Check for folders inside the response
  3. There should be size field present for folder as well.

Expected behavior

Document library rest api for SharePoint should return the size of folder as well.

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

akanshi-elastic commented 1 year ago

Any update on this issue?