EventHubPasswordRequired Event
Occurs when a document requires password for opening.

Namespace: GroupDocs.Search.Events
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 21.6
Syntax
public event EventHandler<PasswordRequiredEventArgs> PasswordRequired

Value

Type: SystemEventHandlerPasswordRequiredEventArgs
Examples
The example demonstrates how to use the event.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

// Creating an index
Index index = new Index(indexFolder);

// Subscribing to the event
index.Events.PasswordRequired += (sender, args) =>
{
    if (args.DocumentFullPath.EndsWith("ProtectedDocument.pdf", StringComparison.InvariantCultureIgnoreCase))
    {
        args.Password = "123456";
    }
};

// Indexing documents from the specified folder
index.Add(documentsFolder);
See Also