My users like to upload password-protected Word documents into our custom document management system. I’d like to add a validation to check for the password and refuse the upload if it has a password.
Automating Word – with COM interop – is out of the question because this is a server side application.
Unfortunately it’s not available directly from .NET or DSOFile.dll, but you could create a wrapper in .NET to read the PIDSI_DOC_SECURITY property of any Office file to find out if it is password-protected or not without opening the document. There are a number of C++ samples out there that could be ported with a definition of
iPropertyStorage.A wrapped example is on TechTarget, but the wrapper seems to be unavailable.