That's a terrible constraint. One that cannot be enforced properly either – starting with the temporary files Word / Excel generates within the same folder when opening them on the share to no error message existing, informing the user they can only save extension A, B, C. Apart from that – technically it doesn't make any sense either, as it doesn't provide any additional security since any file can also be polyglot:
https://github.com/ansemjo/truepolyglot
This is something you have to solve through process, not technical constraint.
Otherwise you're better off creating a small script that runs every minute and deletes all files that do not match extension A, B, C.