0

When retrieving folders contents using the Autodesk Forge API GET projects/:project_id/folders/:folder_id/contents endpoint or using the GetFolderContentsAsync method in the Autodesk.Forge.FoldersApi C# client respectively, it looks like there is no way of telling, whether a folder can be expanded = has any subfolders.

A round trip to the server and retrieving the folder contents is required for each folder in the collection to see if any subfolders exist. Is there a better way to do that which would not be so inefficient? Something like a flag in the GET projects/:project_id/folders/:folder_id/contents return payload?

Sebastian Zaklada
  • 2,308
  • 1
  • 14
  • 25

1 Answers1

0

The /contents/ endpoint returns a list, for each list item, if "type":"folders" you can look at .attributes.objectCount property, which indicates if that folder contains objects.

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • We found `.attributes.objectCount` returning negative values in many cases, where such negative value could be found both for empty and non-empty folders. – Sebastian Zaklada Jun 28 '18 at 12:43
  • for those folders with a negative value, what do you have on the folder? That will help investigate what's happening. – Augusto Goncalves Jun 28 '18 at 12:48
  • Not sure what you are asking. One folder is empty, the other one has both sheets and one subfolder in it. There is no pattern, actually... I can send more details to Mikako if that would help investigating. – Sebastian Zaklada Jun 28 '18 at 14:48
  • Yes, please send, and mention this stackoverflow question (link) – Augusto Goncalves Jun 28 '18 at 19:35
  • I sent more details to Mikako last Friday. However something struck me just now @augusto-goncalves - if `.attributes.objectCount` - when functioning properly - has been designed to return number of _objects_ in a folder it would still not help my case, unless only another folder can be counted towards this count. I believe that files and/or sheets would count as objects as well though. How is it supposed to work? – Sebastian Zaklada Jul 02 '18 at 14:49