We have a C# Windows application that uses PnP Core to interact with SharePoint files.
We have a function in our app that uploads files to a SharePoint folder that the user selects. At the moment, we are catching any permission-related issues during the file upload process.
Is there a way to check if the user has permissions to upload a file to the selected SharePoint folder, BEFORE attempting to upload it?
We started looking at the specific SharePoint permissions / roles of the user, but we were not sure if that was the best path, or also what to actually look for.
You will need to check if the user has access to the folder. Essentially the user should have "Microsoft.SharePoint.Client.PermissionKind.AddListItems" at the folder level.
Here is a code sample for CSOM (you will need to adapt if using PnP):