WordSecurityAgentTools Class
Provides agent tools for document security, protection, and encryption. Handles password protection, encryption, and document access control.
Inherited Members
Namespace: Syncfusion.AI.AgentTools.Word
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class WordSecurityAgentTools : AgentToolBase<WordDocument>
Constructors
WordSecurityAgentTools(DocumentStorageManager)
Initializes a new instance of the WordSecurityAgentTools class (Mode 2 — DocumentStorage).
Declaration
public WordSecurityAgentTools(DocumentStorageManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| DocumentStorageManager | manager | The document storage manager. |
WordSecurityAgentTools(WordDocumentManager)
Initializes a new instance of the WordSecurityAgentTools class (Mode 1 — InMemory).
Declaration
public WordSecurityAgentTools(WordDocumentManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| WordDocumentManager | manager | The document manager for managing Word documents. |
Methods
DecryptDocument(String, String, String)
Removes encryption from a document.
Declaration
[Tool(Name = "DecryptDocument", Description = "Removes encryption from the Word document. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode). The document must be loaded with the correct password first.")]
public AgentToolResult DecryptDocument([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to decrypt")] string documentIdOrFilePath, [ToolParameter(Description = "The protection password")] string password, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to decrypt. |
| System.String | password | The password used to decrypt the document. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating whether the document was decrypted successfully. |
EncryptDocument(String, String, String)
Encrypts the document with a password.
Declaration
[Tool(Name = "EncryptDocument", Description = "Encrypts the document using the provided password. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult EncryptDocument([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to encrypt")] string documentIdOrFilePath, [ToolParameter(Description = "The password used to encrypt the document")] string password, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to encrypt. |
| System.String | password | The password used to encrypt the document. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating whether the document was encrypted successfully. |
ProtectDocument(String, String, String, String)
Protects the Word document with a password and protection type.
Declaration
[Tool(Name = "ProtectDocument", Description = "Protects the Word document with password and protection type. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ProtectDocument([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to protect")] string documentIdOrFilePath, [ToolParameter(Description = "The password used to protect the document")] string password, [ToolParameter(Description = "The type of protection to apply. Accepted values: 'AllowOnlyComments' (also: 'comments') - allows only adding or modifying comments; 'AllowOnlyFormFields' (also: 'formfields', 'form fields') - allows only modifying form field values; 'AllowOnlyRevisions' (also: 'revisions', 'trackchanges', 'track changes') - allows only tracked changes (accept/reject options are disabled in Word); 'AllowOnlyReading' (also: 'readonly', 'read only', 'read-only', 'reading') - read-only access, no editing allowed; 'NoProtection' (also: 'none', 'noprotection') - removes protection and allows full editing access.")] string protectionType, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to protect. |
| System.String | password | The password used to apply document protection. |
| System.String | protectionType | The type of protection to apply, such as allowing comments, form fields, revisions, read-only access, or no protection. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating whether the document protection was applied successfully. |
UnprotectDocument(String, String, String)
Removes protection from a document using the password.
Declaration
[Tool(Name = "UnprotectDocument", Description = "Removes protection from the Word document using the provided password. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult UnprotectDocument([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to unprotect")] string documentIdOrFilePath, [ToolParameter(Description = "The password used to unprotect the document")] string password, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode) of the document to unprotect. |
| System.String | password | The password used to remove document protection. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating whether the document was unprotected successfully. |