How to Find SharePoint Folders Where Current User Has Edit Permission
Question details
A developer needs to retrieve and display SharePoint library folders in an SPFx web part, specifically filtering for folders where the signed-in user has edit access.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Developing an SPFx web part that dynamically lists folders based on the unique effective permissions of the currently signed-in user.
- Observed behavior
- The standard SharePoint REST API lacks a direct OData filter to return folders exclusively based on the current user's effective permissions, requiring a custom approach to evaluate access levels.
Ensure you have the necessary administrative privileges to view site permissions and that your SPFx environment is properly configured to make Microsoft Graph or REST API calls.
Retrieve and Inspect EffectiveBasePermissions via SharePoint REST API
Query the entire folder list and evaluate the EffectiveBasePermissions property for each item to determine if the current user has edit rights.
Since the SharePoint REST API does not support filtering directly by effective permissions in the OData query, you must retrieve the folders first and filter the array on the client side.
Use the REST endpoint `/_api/web/lists/getbytitle('LibraryName')/items?$expand=Folder&$select=Id,Title,Folder/ServerRelativeUrl,EffectiveBasePermissions` to fetch the library contents.
Extract the `EffectiveBasePermissions` object from each returned folder item within your SPFx web part logic.
Use the `SP.BasePermissions` class in your code to verify if the `High` and `Low` properties contain the `EditListItems` permission mask.
Create a new array by pushing only the folders that successfully pass the edit permission check, and bind this array to your UI for display.

Evaluate Effective Permissions Using Microsoft Graph API
Use Microsoft Graph API to request drive items and evaluate the current user's roles and access levels on each folder.
Boost Your Productivity with WPS Office
While SharePoint handles complex web developments and permission structures, you need a reliable, lightweight suite for everyday document tasks. WPS Office provides a seamless, free alternative to Microsoft Office for creating, editing, and sharing documents, spreadsheets, and presentations.

Frequently Asked Questions
Why doesn't SharePoint REST API allow direct filtering by effective permissions?
The SharePoint REST API queries the database directly for item metadata using OData. Effective permissions are calculated dynamically based on user identity, Active Directory groups, and site roles at runtime, which prevents straightforward OData filtering.
Can I use CAML queries to filter folders by user permissions?
No, CAML queries do not support filtering directly by the current user's permission level. You must retrieve the items first and filter them on the client side using the EffectiveBasePermissions property.
Is it faster to check permissions via PowerShell or SPFx?
PowerShell (such as PnP PowerShell) is typically faster for backend administrative reporting as it runs directly against the tenant without client-side rendering overhead. However, SPFx is strictly required if you are building live, user-facing interfaces within SharePoint pages.




