• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Search PST

Searches for messages in a PST file matching the supplied criteria.

Code

using DRIT.Mail;
using DRIT.Mail.Pst.PhysicalLayout;
using DRIT.Mail.Search;

using var pst = new PstFile("archive.pst");

var criteria = new MailSearchCriteria
{
    SubjectContains = "invoice",
    FromContains = "billing@example.com",
};

foreach (IMailMessage match in MailSearcher.Search(pst, criteria))
{
    Console.WriteLine($"Subject: {match.MapiMessage.Subject}");
    Console.WriteLine($"Sender:  {match.MapiMessage.SenderName}");
}

Remarks

MailSearcher.Search enumerates all folders and messages in the PST and returns those matching the MailSearchCriteria. Matching is case-insensitive by default.

  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX