
In Salesforce, you can create different folders for internal users. All of these are categorized under CollaborationGroup.
To access the “All Internal Users” folder in Salesforce Apex, utilize the standard object CollaborationGroup. This object represents the folder, and you can query it with Apex code to retrieve the folder and its contents. You can also apply a SOQL query to filter results based on specific criteria, like name, type, or owner.
Example:
List folderList = [SELECT Id, Name, CollaborationType, OwnerId FROM CollaborationGroup WHERE CollaborationType = 'Files'];
This query will return all folders of type “Files”, allowing you to access their properties such as Id, Name, and OwnerId. You can also iterate through folderList to obtain details of each folder.
Note: Ensure that the Apex class has the necessary permissions to access the “CollaborationGroup” object.