# Search-OfficeDocument

Searches one Reader result or every supported document below file and folder paths.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Reader.OfficeDocumentReadResult` `System.String[]`

**Outputs**

`OfficeIMO.Reader.OfficeDocumentSearchResult` `PSWriteOffice.Models.Reader.OfficeDocumentSearchMatch`

**Source**

[SearchOfficeDocumentCommand.cs:28](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Reader/SearchOfficeDocumentCommand.cs#L28) 

Searches one Reader result or every supported document below file and folder paths.

## Syntax

```
Search-OfficeDocument
[-AllResults]
[-InputObject] <OfficeDocumentReadResult>
[-MatchCase]
[-MaximumResults <Int32>]
[-Query] <String>
[-WholeWord]
[<CommonParameters>]
```

[#](#method-search-officedocument-switchparameter-officedocumentreadresult-switchparameter-int32-string-switchparameter)

Parameter set: `Document`

```
Search-OfficeDocument
[-AllResults]
[-AllStoreItems]
[-Extension <String[]>]
[-IncludePageLocations]
[-MatchCase]
[-MaxDegreeOfParallelism <Int32>]
[-MaxDocuments <Int32>]
[-MaximumResults <Int32>]
[-MaxStoreItems <Int32>]
[-NoDocumentLimit]
[-Path] <String[]>
[-Query] <String>
[-Recurse]
[-StopOnError]
[-WholeWord]
[<CommonParameters>]
```

[#](#member-4a5a6614239a3a1578ebde12)

Parameter set: `Path`

## Examples

### Search a mixed document folder without constructing .NET option objects.

```powershell
Search-OfficeDocument -Path .\Evidence -Recurse -Query 'retention period'
```

Automatically reads supported Word, Excel, PowerPoint, PDF, email, PST, OST, and other registered formats.

### Remove the default document, store-item, and result ceilings.

```powershell
Search-OfficeDocument -Path .\Evidence -Recurse -Query 'invoice' -NoDocumentLimit -AllStoreItems -AllResults
```

Unlimited modes are explicit because very large stores and document collections can consume substantial resources.

## Parameters

**-AllResults SwitchParameter optional**

Return every occurrence from each document instead of applying the default result ceiling.

**-InputObject OfficeDocumentReadResult requiredposition: 0pipeline: True (ByValue)sets: Document**

Normalized document returned by Get-OfficeDocument.

**-MatchCase SwitchParameter optional**

Use case-sensitive ordinal matching.

**-MaximumResults Int32 optionalaliases: MaxResultsPerDocument**

Maximum occurrences returned per document. The default is 1,000.

**-Query String requiredposition: 1**

Text to find in normalized document blocks.

**-WholeWord SwitchParameter optional**

Return only occurrences surrounded by non-word characters.

**-AllStoreItems SwitchParameter optionalsets: Path**

Project every matching item from each email store.

**-Extension String[] optionalaliases: Extensionssets: Path**

Optional extensions to include. Registered Reader formats are used automatically when omitted.

**-IncludePageLocations SwitchParameter optionalsets: Path**

Compute Word and RTF page locations when supported.

**-MaxDegreeOfParallelism Int32 optionalsets: Path**

Maximum document reads in flight.

**-MaxDocuments Int32 optionalsets: Path**

Maximum documents accepted in one search. The default is 500.

**-MaxStoreItems Int32 optionalsets: Path**

Maximum PST, OST, OLM, or EMLX items projected from each store. The default is 1,000.

**-NoDocumentLimit SwitchParameter optionalsets: Path**

Remove the document-count ceiling.

**-Path String[] requiredposition: 0pipeline: True (ByValue, ByPropertyName)aliases: FilePath, FullNamesets: Path**

File, directory, or wildcard path to search.

**-Recurse SwitchParameter optionalsets: Path**

Search subdirectories.

**-StopOnError SwitchParameter optionalsets: Path**

Terminate the search when one document cannot be read. The default reports the error and continues.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

## Outputs

PSWriteOffice.Models.Reader.OfficeDocumentSearchMatch: PowerShell-friendly occurrence returned by a path-based document search.

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:CC65AC518630F5274E3475E0F3476889D7697AB6408C81AA339FF1E8A2A640E8 -->
