function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Femi Agbaje-WilliamsFemi Agbaje-Williams 

Get the list of users or roles that have access to Report Folder via APEX or SOQL

Hi, Is there a way to get the list of users, roles, public groups that have access to a report folder or dashboard folder via  SOQL or APEX? I am trying to add and remove users or roles from  100+ folders.

Thanks,
Femi
SwethaSwetha (Salesforce Developers) 
HI Femi,

There does not seem to be a direct way to fetch this information.You might want to try 
SELECT RecordId, HasReadAccess FROM UserRecordAccess WHERE UserId = '00524000001O6ME' AND RecordId = '00O24000004DCbL'
Here the RecordId is the Report Id. However,  this would require multiple queries - one to fetch the list of reports and one to check the access.

Please see related https://salesforce.stackexchange.com/questions/102044/soql-to-find-which-reports-are-accesed-by-what-profile
https://salesforce.stackexchange.com/questions/99081/soql-list-reports-current-user-can-access?rq=1
https://trailblazers.salesforce.com/answers?id=90630000000hheuAAA

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Femi Agbaje-WilliamsFemi Agbaje-Williams
Hi Swetha, Thanks for your response. I am going to manually remove the users.
Thanks, Femi