Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Search-OfficeDocument

Module PSWriteOffice
Inputs
OfficeIMO.Reader.OfficeDocumentReadResult System.String[]
Outputs
OfficeIMO.Reader.OfficeDocumentSearchResult PSWriteOffice.Models.Reader.OfficeDocumentSearchMatch

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>]
#
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>]
#
Parameter set: Path

Examples

Authored help example

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

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.

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.

Outputs

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