Skip to end of metadata
Go to start of metadata
Contents Summary
 

The code in below examples uses some methods defined in Common Utilities

Searching & Indexing Password Protected Documents

This feature is supported by version 16.12 or greater.

GroupDocs.Search API allows to add password protected documents to index and hence provides the functionality to search among the protected documents as well. The API sets password for indexing password protected documents in the following ways:

  1. Using event argument to set password for protected document
  2. Using Index.Dictionaries.DocumentPasswords property to set password for protected document
  3. Using both methods 1 and 2

Using Event Argument to Set Password

Following code snippet shows how to subscribe to PasswordRequired event to be able to specify a password

Following code snippet shows the event which will appear for every password protected document

 

Using Index.Dictionaries.DocumentPasswords Property to Set Password

To set a password for protected documents using Index.Dictionaries.DocumentPasswords property, follow the following steps:

  • Initialize Index object by passing indexFolder.
  • Set password of the protected document using index.Dictionaries.DocumentPasswords.Add(DocumentPath, Password) method
  • Add documents folder to index

Following is the code inspect.

Using Both Event Argument and Index.Dictionaries.DocumentPasswords Property to Set Password

Following code snippet shows how the password for a protected document is set for indexing using both event argument and index.Dictionaories.DocumentPasswords property.

Inherit Password Dictionary from IEnumerable to Make it Work Like Other Dictionaries

This feature is supported by version 17.2 or greater

The API allows to use privileges of IEnumerable for Password dictionary. Following code snippet shows how to use GetEnumerator method.

Labels
  • No labels