Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the protection type for the document.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public ReadOnly Property ProtectionType As WdProtectionType
'Usage
Dim instance As Document
Dim value As WdProtectionType
value = instance.ProtectionType
public WdProtectionType ProtectionType { get; }
public:
property WdProtectionType ProtectionType {
WdProtectionType get ();
}
public function get ProtectionType () : WdProtectionType
Property Value
Type: WdProtectionType
The returned protection type can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions, or wdNoProtection.
Examples
The following code example checks whether protection has been set for the document. If not, the code sets protection to allow only comments.
This example is for a document-level customization.
Private Sub DocumentProtectionType()
If Me.ProtectionType = Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection Then
Me.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyComments)
End If
End Sub
private void DocumentProtectionType()
{
if (this.ProtectionType == Microsoft.Office.Interop.
Word.WdProtectionType.wdNoProtection)
{
this.Protect(Microsoft.Office.Interop.Word.
WdProtectionType.wdAllowOnlyComments,
ref missing, ref missing, ref missing,
ref missing);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.