Share via


DocumentBase.PasswordEncryptionFileProperties Property

Gets a value that indicates whether Microsoft Office Word encrypts file properties for password-protected documents.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property PasswordEncryptionFileProperties As Boolean
public bool PasswordEncryptionFileProperties { get; }

Property Value

Type: System.Boolean
true if Microsoft Office Word encrypts file properties for password-protected documents; otherwise, false.

Remarks

Use the SetPasswordEncryptionOptions method to specify whether Word encrypts file properties for password-protected documents.

Examples

The following code example sets the password encryption options if the file properties are not encrypted for password-protected documents. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentPasswordEncryptionFileProperties()
    If Me.PasswordEncryptionFileProperties = False Then 
        Dim PasswordEncryptionProvider As String = _
            "Microsoft RSA SChannel Cryptographic Provider" 
        Dim PasswordEncryptionAlgorithm As String = "RC4" 
        Dim PasswordEncryptionKeyLength As Integer = 56
        Dim PasswordEncryptionFileProperties As Object = True 

        Me.SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)
    End If 
End Sub
private void DocumentPasswordEncryptionFileProperties()
{
    if (this.PasswordEncryptionFileProperties == false)
    {
        string PasswordEncryptionProvider = "Microsoft RSA SChannel Cryptographic Provider";
        string PasswordEncryptionAlgorithm = "RC4";
        int PasswordEncryptionKeyLength = 56;
        object PasswordEncryptionFileProperties = true;

        this.SetPasswordEncryptionOptions(PasswordEncryptionProvider,
            PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength,
            ref PasswordEncryptionFileProperties);
    }
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace