Implement Document.Protect and Document.Unprotect in Word JavaScript API
We are using office.JS add-in and javascript apis of word.
Is it technically possible to achieve the following using Office.js in a Word add-in?
We want to add custom properties (such as document IDs and metadata) to Word documents opened via our add-in. Based on the presence of specific custom properties or keywords, we aim to disable Word's default 'Save,' 'Save As,' and 'Share' options to prevent users from saving or sharing the document locally.
Additionally, we would like to implement custom protection mechanisms through our add-in. Could you please confirm whether this functionality can be implemented and suggest best practices or limitations we should be aware of?
HI
it is possible to save and read custom properties via Office.js :
https://learn.microsoft.com/en-us/javascript/api/word/word.customproperty?view=word-js-preview
It is not possible to intercept the save event or disable the button, I created the idea to handle the save event:
It is not even possible to implement document protection
Follow this post or my idea :
- mkanorwalaFeb 10, 2025Copper Contributor
Hi DavideBono thanks for your reply. Yes i Achieved the saving and reading custom properties via office.JS. but i want to see if we can achieve it by writing any .net command or handler to handle this but via office.js in some way? Is there a work around?. Or the other part is I am using web-dav to open files on word from server using web-dav url. So based on if the document is a web-dav url or not can we do it?