Click or drag to resize

Example 8: Enumerate folders and workspaces

This example gets a list of all folders and workspaces that the user has access to. There are two steps: get a list of all workspaces and then get a list of all folders in these workspaces.

Get list of workspaces (rooms) for the user
C#
Resource.Workspaces workspaces = apiSession.GetWorkspacesResource();

// This returns a list of rooms, which can be iterated over. The other parameters
// include: addExternalData, adminMode, includeSyncData, includeWorkspacePolicyData,
// and workspaceTypes. Please see the javadoc documentation for details.

ItemListJson<WorkspaceInfoJson> itemListJson =
    workspaces.ListRoomsV30(null, true, true, false, false);
Get list of folders in a specific Workspace
C#
Resource.Workspaces workspaces = apiSession.GetWorkspacesResource();

// This returns a folder object, which contains details about the current workspace,
// as well as a sub folder list that can be iterated over.
FolderJson folderJson = workspaces.GetFolderTreeV30(roomId, null);

List<FolderJson> subFolders = folderJson.SubFolders;