Fix SharePoint Search Cannot Find Documents by Leading Numbers
Question details
Users are unable to reliably locate documents in SharePoint search using document names that start with long numeric identifiers or leading zeros.

- Product
- SharePoint
- Device & OS
- not provided
- Scenario
- Searching for specific documents in a SharePoint document library using the numeric prefixes or long numeric IDs contained in the file names.
- Observed behavior
- SharePoint search returns unreliable results or completely fails to find the target documents when the search query relies on leading zeros or long numeric portions of the file name.
Ensure you have Site Owner or List Administrator permissions in SharePoint to create new columns, and confirm you have an active Power Automate license to create flows for the site.
Create Metadata Columns and Populate via Power Automate
Bypass file name search limitations by extracting the numeric identifiers into searchable single-line text columns using a Power Automate flow.
SharePoint's default search tokenizer can struggle with long numbers or leading zeros within file names, treating them in ways that cause search failures. By extracting these specific identifiers into dedicated text columns, the search index can reliably locate the files based on exact metadata matches.
Navigate to your SharePoint library, click 'Add column', select 'Text', and create columns to store the complete file name and the extracted numeric identifiers.
Review your document library to identify variations in numeric identifiers. Note if the identifiers have different lengths (e.g., 11, 12, or 13 digits) or varying leading zeros, so you can handle them appropriately.
Open Power Automate and create an automated cloud flow that triggers when a file is created or modified. Use 'Compose' actions to process the file name.
Add dynamic expressions like substring(outputs('Compose'),12,8) to extract the exact numeric portion based on the identifier's format. If lengths vary, add condition blocks to handle different formatting rules.
Add the 'Update file properties' action to SharePoint. Map the outputs of your substring expressions to the newly created single-line text columns.
Allow time for the SharePoint search crawler to index the newly populated columns. Once complete, search using the metadata columns instead of relying on the file name.

View and Edit Your Office Documents with WPS Office
While you manage file metadata and search configurations in SharePoint, consider WPS Office as a lightweight, free alternative for viewing and editing your downloaded Word, Excel, and PDF files without heavy subscription fees.

Frequently Asked Questions
Why does SharePoint struggle to search file names with leading zeros?
SharePoint's search engine tokenizes text differently based on delimiters and characters. It often strips or misinterprets leading zeros and very long numeric strings, which leads to incomplete or missing search results when users query exact numbers.
Can I run the Power Automate flow on documents already existing in the library?
Yes, you can create a manual trigger or a scheduled flow to iterate through existing files in the library using the 'Get files' action. Be cautious to accommodate all identifier variations so numbers are not truncated during the update.
What if my file names have identifiers of different lengths?
You should incorporate conditional logic (Condition or Switch actions) in your Power Automate flow to check the length or specific text patterns of the file name before applying the substring expression. This ensures accurate extraction whether the number is 11, 12, or 13 digits long.
How long does it take for the new metadata columns to become searchable?
SharePoint Online performs continuous crawls, meaning new metadata is typically indexed and searchable within 15 minutes to an hour. However, it can occasionally take longer depending on server load and the size of your document library.




