apex and user folder

How to access the All Internal Users folder in the apex

In salesforce we can create different folders for internal users usage. all are comes under CollaborationGroup.

To access the “All Internal Users” folder in Salesforce Apex, you can use the standard object CollaborationGroup. This object represents the folder, and you can query it using the Apex code to retrieve the folder and its contents. You can also use the SOQL query to filter the results based on specific criteria, such as name, type, or owner.


List<CollaborationGroup> folderList = [SELECT Id, Name, CollaborationType, OwnerId FROM CollaborationGroup WHERE CollaborationType = 'Files'];

This query will return all the folders of type “Files”, and you can access their properties such as the Id, Name, and OwnerId. You can also loop through the folderList to get the details of each folder.

Note: Make sure that the Apex class has the necessary permissions to access the “CollaborationGroup” object.

Leave A Comment