Filtering and Exporting Outlook Items by EntryIDs

Compatibility: Outlook for Microsoft 365, Outlook 2021, Outlook 2019, Outlook 2016, Outlook 2013

When managing a large number of Outlook items stored in .pst and .ost files, filtering and exporting based on unique identifiers is crucial. This topic describes using the EntryID (PR_ENTRYID) and ID (PR_RECORD_KEY) properties of an item to filter and export items to different file formats.

EntryID Property

This property corresponds to the MAPI property PidTagEntryId. The EntryID is used by message store and address book providers as a unique identifier for their objects. Solutions should not depend on the EntryID property to be unique unless items will not be moved. The EntryID changes when:

  • an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder;
  • an item is moved from one Personal Folders (.pst) file to another .pst file;
  • an item is exported and then imported (even to the same folder);
  • an Outlook data file is renamed or moved (and has been accessed through MAPI or opened in Outlook).

This property can contain either a long-term or a short-term identifier.

ID Property

This property corresponds to the MAPI property PidTagRecordKey. This property is a binary value that uniquely identifies a row in a table view. The ID property does not change when an Outlook data file is renamed or moved. Each new or modified Outlook item is assigned an ID number that is greater than the previous one.

Filtering Items by EntryIDs and IDs

To filter Outlook items by EntryIDs, you can enter the EntryID of the item in the search box and press Enter. The search string is in hexadecimal format. You can use Boolean search operators and wildcards (*, ?) to search for EntryIDs based on patterns.

Filtering by item EntryID (PR_ENTRYID)

To filter Outlook items by IDs, enter the ID of the item in the search box and press Enter. The search is performed using a hexadecimal number. To find recent items, you can use the less than (<) or greater than (>) operators.

Filtering by item ID (PR_RECORD_KEY)

To export the search results, you can select all items (Ctrl+A), go to File > Export, choose the desired file format, and select "Selected items only".

Exporting Items by EntryIDs Using PowerShell

PstScan Pro can export items by EntryIDs and IDs from .pst and .ost files in batch scripts. This can be done using PowerShell, Task Scheduler, and other automation tools. To accomplish the export, you need to utilize the command line options provided by the software.

Example 1: Exporting items by EntryID

cd "C:\Program Files (x86)\PSTWalker Software\PstScanPro"
$PSTFiles = @("c:\outlook.pst", "c:\outlook.ost") foreach ($PST in $PSTFiles){ .\pstscanpro.exe convert eml -f "$PST" -n entryId --% -q "entryid:BF4FEA0B6AD6C14ABBEE82F4858DE8B724A95200" -p "D:\PST-Exports" --headers --srcfolders }

This example searches outlook.pst and outlook.ost mailboxes for items in which the EntryID equals BF4FEA0B6AD6C14ABBEE82F4858DE8B724A95200. The search results are exported as .eml files to the directory D:\PST-Exports\. The .eml files are named using the EntryIDs.

When running native commands from PowerShell, the arguments are first parsed by PowerShell. Beginning in PowerShell 3.0, you can use the stop-parsing (--%) token to stop PowerShell from interpreting input as PowerShell commands or expressions.

Example 2: Exporting items by IDs

Command Prompt
cd C:\Program Files (x86)\PSTWalker Software\PstScanPro
pstscanpro.exe convert pst -f c:\users\*.pst -p "D:\PST-Queries" -q "id:>=52A924" --srcfolders --fullscan --harddel

In this example, both messages and hard deleted messages with item IDs greater than or equal to 52A924 are exported from all .pst files located in the c:\users folder. The search results are then exported as .pst files to the D:\PST-Queries directory.

Search reference tables

The following table shows you some examples of searches you might find useful. In addition to these examples, you can use AND, OR, NOT, ALL, ATLEASTONE, NEITHER, NOTALL, ?, *, <, >, =, and other operators to refine your search. Operators should be typed in uppercase letters.

Type this To find this
subject:"Project meeting" Items whose subject contains the phrase Project meeting.
from:="bobby moore" Items whose sender name equals bobby moore.

Note the use of the "equals" comparison operator (=).
from:( OR "bobby moore") Items in which the e-mail address equals OR sender name contains bobby moore.

Note the use of parentheses to group the display name and email address.
from:( OR "CN=BOBBYMOORE") Items in which the e-mail address equals OR Exchange x.500 address contains CN=BOBBYMOORE.

The Active Directory/Exchange x.500 email address is an address used internally on Exchange servers:
to:mike OR cc:mike OR bcc:mike Items in which the display name mike is on the To or Cc or Bcc line .
received:>=2021-03-23 AND received:<=2021-04-23 Search for items that arrived between March 23, 2021 and April 23, 2021.
sent:=4/1/21 Search for items sent on April 1, 2021.
body:agenda Items that contains agenda within its contents.
messageclass: IPM.Contact Display only contact items.

IPM.Note - Email messages
IPM.Note.SMIME - both signed/encrypted messages
IPM.Task - Tasks
See more Item Types and Message Classes
messagesize:<=500 KB Items whose size is less or equal than 500 kilobytes.

Note: B, KB, MB, GB, TB units are allowed.
read:no Items that have not been read. You can also use read:false to get the same results.
hasattachment:yes Items that have attachments. You can also use hasattachment:true to get the same results.
entryid: 00BF4FEA0B6AD6C14A858DE8B724A95200 Find an item by PR_ENTRYID (PidTagEntryId). A hexadecimal search string is used.
id: >=52A924 Find items by PR_INSTANCE_KEY (PidTagInstanceKey) or PR_RECORD_KEY (PidTagRecordKey). A search is performed using a hexadecimal number.
attachments:ATLEASTONE("pdf", "txt", "zip") Items that have attachments with extension pdf or txt or zip

Note the use of ATLEASTONE function.
ALL(messagesize:<=100kb, hasattachment:yes,
ATLEASTONE(attachments: "txt", attachments: "pdf"))
Items less than 100KB in size with attachments with the extension txt or pdf.
Visual search tree
  • Press F1 in search box to show search tree.

Updated on July 07, 2023

Facebook Email

See Also

OST PST Viewer

Open and view multiple .pst and .ost files without Outlook. Recover deleted items and folders, search all Outlook items, and extract emails and attachments in bulk.

Boolean Search Syntax

This guide explains boolean search operators, functions and wildcards (AND, OR, NOT, ALL, ATLEASTONE, NEITHER, NOTALL, ?, *)