Accessing the All Internal Users Folder in Apex

Accessing the All Internal Users Folder in Apex

1 Min Read

To create folders for internal users in Salesforce, utilize the CollaborationGroup object. This object allows access to the “All Internal Users” folder through Salesforce Apex. Use Apex code to query CollaborationGroup and retrieve folders and their contents, filtering results by criteria like name, type, or owner with SOQL queries.

Example:

“`apex
List folderList = [SELECT Id, Name, CollaborationType, OwnerId FROM CollaborationGroup WHERE CollaborationType = ‘Files’];
“`

This query retrieves folders of type “Files”, allowing access to their Id, Name, and OwnerId. Iterate through folderList to examine each folder’s details.

Note: Ensure necessary permissions are granted to access the CollaborationGroup object in Apex.

You might also like