Updated writeProtection logic

midget 0 Reputation points
2023-02-06T09:05:15.8266667+00:00

Hi,

it looks like MS have changed how the writeProtection element (one definition found https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.writeprotection?view=openxml-2.8.1) behaves in Word documents.

Prior to Word 365 2022.9 (September release), when w:writeProtection was present in the OpenXML package, settings part, the document would give a prompt for password. If password entered - document would be unlocked, if not entered - document would open, but some sections (mso-section-protection) would be locked, however those sections without section protection - would be unlocked and could be altered.

In newer version of word 365 - the document is fully protected, i.e. not possible to alter content.

Was it an intentional change? or is it a bug that MS are going to reverse?

Also, what is the difference between writeProtection and documentProtection https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.documentprotection?view=openxml-2.8.1?

Edit: changed "WordProtection" to "writeProtection"

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
3,738 questions
Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
655 questions
Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
119 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tom Jebo 1,906 Reputation points Microsoft Employee
    2023-02-28T18:54:58.3433333+00:00

    @midget,

    I've not heard back from you on this thread for quite some time. If you still need assistance please post here.

    From my investigation, it looks like w:writeProtection still causes the prompt for password and indeed locks the whole document but the section protection appears to be under w:documentProtection. If this is not what you were seeing previously, can you provide the test document you're using so I can see how it's coded?

    Also, can you confirm whether you are using the HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Security\UseIsoPasswordVerifier
    key that is described in [MS-OI29500] 2.1.426 Part 1 Section 17.15.1.93, writeProtection (Write Protection)?

    Tom

    0 comments No comments