Skip to main content
Question

How to Retrieve Subfolder IDs from a Box Folder Using box.Toolkit

  • October 20, 2026
  • 1 reply
  • 10 views
  • Translate All

Hi ,

I would like to retrieve the IDs of subfolders within a Box folder associated with a Salesforce record.

I believe the box.Toolkit class's getFolderContents method might be useful for this purpose, but I'm not sure what information is returned in the FolderContents object.

Could anyone clarify the following?

  1. What information does the FolderContents object contain?
  2. Is it possible to retrieve a folder ID by using the folder name as a key from the FolderContents object?

Any advice or code examples would be greatly appreciated.

Thank you in advance for your help!

1 reply

Jason S
Forum|alt.badge.img
  • Box Employee
  • October 20, 2026

Hi ​@reina.ueno,

Yes, box.Toolkit.getFolderContents() can help retrieve the items inside a Box folder. The FolderContents object represents the folder’s contents as a list of entries; each entry includes information about an item, such as its name, type, and ID. Folder IDs are part of each folder entry.

You can loop through the entries and match the folder by name. The folder name isn’t a key you can use to look up an ID directly, and names may not be unique, so check the item type and confirm the parent folder if needed.

box.Toolkit toolkit = new box.Toolkit();
box.FolderContents contents = toolkit.getFolderContents(parentFolderId);

for (box.Folder item : contents.folders) {
if (item.name == 'Subfolder Name') {
System.debug('Folder ID: ' + item.id);
}
}

The exact property names may vary by Toolkit version. If FolderContents doesn’t expose folder entries in your installed package, check the class definition in Salesforce or use the Box SDK for Salesforce to call the Box folder items endpoint. The Toolkit is intended for common integration customizations and isn’t a full Box Content API wrapper. Box Dev Docs

See the Salesforce Developer Toolkit documentation and code samples.

Translate