Please can someone advise of the best way to pre-validate a file that is being uploaded to a Modern SharePoint Online site :
To check that the filetype is an approved type in a whitelist ( eg pdf , doc or xls ),
To check there is no password (or may be that it has )
To check that required metadata is present, and meets the appropriate rules.
I want to stop the file from being uploaded, with a warning if these business rules are broken.
I am comfortable with the CSOM client context code, and with the C# code to do the actual validation. Its just what is the best way to hook it into the SP Online equivalent of what was called the 'Inserting' event in SharePoint 2010 , as the user is uploading.
The issues I have faced so far are
SharePoint out of the box lets you upload documents and leave 'mandatory' fields empty.
SharePoint out of the box offers only a filetype blacklist (to stop you uploading .bats, .exes etc.). which means you can upload any unsupported file types, or files with no suffixes. I want to implement whitelists, so that we know other users can open open the files.
ContentTypes dont seem to do this.
Webhooks only appear to operate AFTER a file has been successfully uploaded.
Other potential solutions seem to work with 'on premise ' or 'classic' versions not modern online versions
Many thanks in advance
