Bastion PST SDK3.0.0 · Help and API reference

Bastion PST SDK 3.0.0

The guide and the complete API reference for Bastion.Pst.

Bastion PST SDK 3.0.0

Introduction

Bastion PST SDK is a .NET library for Microsoft Outlook data files — .pst and .ost. It is written entirely in managed code: it needs no Outlook, no MAPI and nothing installed on the computers your application runs on. It reads legacy ANSI and modern Unicode stores, including Outlook 2013 and later OST files, and writes Unicode PST files that every Outlook from 2003 onwards opens.

What it does

  • Read folders, messages, recipients, attachments and properties from any PST or OST, of any size, with memory use that stays bounded on multi-gigabyte files. Reading stores.
  • Show a mailbox in your own application: flat, bindable rows for mail, contacts, calendar, tasks, notes and RSS posts, a folder listed from its contents table alone, filters that run before an item is opened, and duplicate contacts folded into one card. Showing a mailbox.
  • Merge any number of stores into one — each kept as its own tree (Stacked) or same-named folders blended (Unified) — with duplicate removal, item-type filters, a pre-merge health scan and a check of the output against the sources. Split a store by size or by any rule, and convert ANSI to Unicode. Merging, splitting and converting.
  • Check and repair: find damage the moment a file is opened, rebuild a damaged store into a new validated file, run Outlook-style structural validation, and set or remove the store password. Checking and repairing.
  • Import and export EML, MSG, OFT, MHTML, MBOX, ICS, VCF and Outlook-for-Mac OLM. Importing and exporting.
  • Create and change stores from code: mail, meetings with attendees and recurrence exceptions, contacts with photos, tasks, notes, journal entries, contact groups and RSS posts; folders created, renamed, moved and typed; items moved, edited and deleted — every write an atomic rewrite, checked before it replaces anything. Creating and changing stores.
  • Report plainly: every operation returns a result with an error code and a sentence fit to show a user, progress events, a plain-language log, and support reports that hold no message content. Errors, progress and logs.

How the API behaves

  • Operations report; they do not throw. Each returns a result object whose ErrorCode is 0 (Ok) on success, with an ErrorDescription fit to show a user and ToString() giving "code: description". See ErrorCode.
  • The one exception is licensing. Without a licence, a trial or a runtime key, the first use of the library throws InvalidOperationException with a message that says what to do. Licensing and deployment.
  • Sources are never written to. Every write produces a new file, built and checked before it replaces anything, so an interrupted or cancelled operation leaves nothing half-written.
  • A legacy ANSI store is never converted without your say-so. The library writes Unicode only, and Outlook 2002 and earlier cannot open Unicode files, so adding to an ANSI store is refused unless you allow it.

Which Outlook opens the files it writes

The library always writes the Unicode PST format, introduced with Outlook 2003.

OutlookOpens the files it writes
Outlook 97, 98, 2000, 2002/XPNo — these read only the legacy ANSI format
Outlook 2003, 2007, 2010, 2013, 2016, 2019, 2021, 2024Yes
Outlook for Microsoft 365 (classic desktop)Yes

The library reads the old ANSI files, and converts them to Unicode when asked. The new Outlook for Windows and Outlook on the web do not use PST files on disk, so they are not in the table.

.NET versions

One build per framework, 23 in all, with the same API in each. There is no netstandard build.

BuildFor
net46, net461, net462, net47, net471, net472, net48, net481 .NET Framework 4.6 to 4.8.1
netcoreapp2.0, netcoreapp3.0, netcoreapp3.1 .NET Core 2.0 to 3.1. A .NET Core 2.1 application uses netcoreapp2.0.
net5.0 to net10.0.NET 5 to 10, on Windows, Linux and macOS
net5.0-windows to net10.0-windowsWindows Forms and WPF applications on .NET 5 to 10

The library runs in 32-bit and 64-bit processes. Merging very large stores needs the address space of a 64-bit process; reading and exporting work in either.

Namespaces

NamespaceFor
Bastion.PstResult types, ErrorCode, Licence, PstEvents
Bastion.Pst.MessagingOpening a store; folders, messages, attachments; search
Bastion.Pst.ViewsBindable rows for an application, filters, item operations
Bastion.Pst.ConvertMerge, split, convert, password
Bastion.Pst.Validation, Bastion.Pst.RepairHealth check, validation, repair
Bastion.Pst.Import, Bastion.Pst.ExportInterchange formats in and out; new empty stores
Bastion.Pst.AuthoringCreating items and changing stores
Bastion.Pst.DiagnosticsProgress, logs, cancellation, corruption recovery

Product and support

Websitebastionsoftwaresolutions.com/products/bastion-pst-sdk
Supportbastionsoftwaresolutions.com/support · support@bastionsoftwaresolutions.email
LicenceSoftware Licence Agreement

This help documents the public API only.

Bastion PST SDK 3.0.0

Getting started

From nothing to a program that opens a PST: add the library, run once under the debugger to start the trial, and read the result of each call.

1. Add the library to your project

From NuGet. Add the package Bastion.Pst. NuGet picks the build for your framework and brings in the Microsoft packages some frameworks need.

<PackageReference Include="Bastion.Pst" Version="3.0.0" />

From the installer. The installer puts one build per framework in Bin\<framework>\ under its install folder, and sets the environment variable BASTION_PSTSDK_DIR to that folder. Reference the DLL for your framework; in an SDK-style project, one line covers every framework the project builds for:

<ItemGroup>
  <Reference Include="Bastion.Pst">
    <HintPath>$(BASTION_PSTSDK_DIR)Bin\$(TargetFramework)\Bastion.Pst.dll</HintPath>
  </Reference>
</ItemGroup>

If Visual Studio was open when you installed, restart it once so it sees the new environment variable. Some Bin folders also hold Microsoft DLLs the library needs on that framework (for example System.Text.Encoding.CodePages.dll beside netcoreapp2.0); Visual Studio copies them to your output with the library.

The installer also gives you Bastion Licence Manager, this help, and the sample projects described in Sample projects.

2. Run it once under the debugger

The first time your project runs under the Visual Studio debugger (F5) on a computer with no licence or trial, the library starts a 30-day trial for you. It needs an internet connection that once. During the trial a merge takes at most two PST or OST files at a time; everything else works without limit. After you buy, activate your licence in Bastion Licence Manager. Neither needs a change to your code.

3. Open a store

Every operation returns a result. Check its ErrorCode, and show ToString() to the user when it is not Ok.

VB.NET

Dim opened = PersonalStorage.TryOpen("mail.pst")
If opened.ErrorCode <> ErrorCode.Ok Then
    Console.WriteLine(opened.ToString())        ' "code: description", fit to show a user
    Return
End If
Using store = opened.Store
    Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders")
End Using

C#

var opened = PersonalStorage.TryOpen("mail.pst");
if (opened.ErrorCode != ErrorCode.Ok)
{
    Console.WriteLine(opened.ToString());          // "code: description", fit to show a user
    return;
}
using (var store = opened.Store)
{
    Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders");
}

Then walk the folders and read the messages:

VB.NET

Sub ShowTree()
    Using store = PersonalStorage.Open("mail.pst")
        Walk(store.RootFolder, 0)
    End Using
End Sub

Sub Walk(folder As Folder, depth As Integer)
    Console.WriteLine(New String(" "c, depth * 2) & $"{folder.DisplayName} ({folder.ContentCount})")
    For Each m In folder.Messages()
        Console.WriteLine(New String(" "c, depth * 2 + 2) & "- " & m.Subject)
    Next
    For Each child In folder.SubFolders()
        Walk(child, depth + 1)
    Next
End Sub

C#

static void ShowTree()
{
    using (var store = PersonalStorage.Open("mail.pst"))
        Walk(store.RootFolder, 0);
}

static void Walk(Folder folder, int depth)
{
    Console.WriteLine(new string(' ', depth * 2) + $"{folder.DisplayName} ({folder.ContentCount})");
    foreach (var m in folder.Messages())
        Console.WriteLine(new string(' ', depth * 2 + 2) + "- " + m.Subject);
    foreach (var child in folder.SubFolders())
        Walk(child, depth + 1);
}

4. Before you ship

An application you give to other people sets a runtime key before it first uses the library. Without one it runs only on a computer where a developer has a licence or a trial, and anywhere else its first use of the library throws InvalidOperationException. Get the key in Bastion Licence Manager (Runtime key…); it is checked offline.

VB.NET

' In the application you ship: once, before the first use of the library -
' at the top of Sub Main, or in the Startup event of a Windows Forms application.
Sub ApplicationStartup()
    Bastion.Pst.Licence.SetRuntimeKey("<your runtime key>")

    ' ... the rest of your application ...
End Sub

C#

// In the application you ship: once, before the first use of the library -
// at the top of Main, or in your App startup.
static void ApplicationStartup()
{
    Bastion.Pst.Licence.SetRuntimeKey("<your runtime key>");

    // ... the rest of your application ...
}

More in Licensing and deployment.

Where next

Bastion PST SDK 3.0.0

Cookbooks

Tasks, one recipe each, in VB.NET and C#.

Every recipe here was compiled and run. The code on these pages is copied, at the time the help is built, from two projects that build against the library and run each recipe on stores made for the purpose. A recipe that cannot be run that way — one that needs a legacy ANSI store, an Outlook-for-Mac archive, or a real runtime key — is compiled but not run, and says so.

The recipes use relative file names such as mail.pst; use your own paths. They assume these imports:

VB.NET

Imports Bastion.Pst                   ' ErrorCode, Licence, PstEvents
Imports Bastion.Pst.Messaging         ' PersonalStorage, Folder, PstMessage, MessageQuery, ItemKind
Imports Bastion.Pst.Views             ' ItemQuery, ItemOps, ContactMerger
Imports Bastion.Pst.Convert           ' StoreMerger, Dedup, MergeLayout, MergePreflight, StoreSplitter, StoreConverter, StorePassword
Imports Bastion.Pst.Validation        ' PstHealth, PstValidator
Imports Bastion.Pst.Repair            ' PstRepair
Imports Bastion.Pst.Import            ' EmlReader, MsgReader, MboxReader, IcsReader, VcfReader, OlmReader, StoreImporter
Imports Bastion.Pst.Export            ' StoreBuilder, StoreExporter, MessageExporter, ItemExporter, ExportFormat
Imports Bastion.Pst.Authoring         ' ItemBuilder, Author, AuthoringSession
Imports Bastion.Pst.Diagnostics       ' DiagnosticsContext

C#

using Bastion.Pst;                    // ErrorCode, Licence, PstEvents
using Bastion.Pst.Messaging;          // PersonalStorage, Folder, PstMessage, MessageQuery, ItemKind
using Bastion.Pst.Views;              // ItemQuery, ItemOps, ContactMerger
using Bastion.Pst.Convert;            // StoreMerger, Dedup, MergeLayout, MergePreflight, StoreSplitter, StoreConverter, StorePassword
using Bastion.Pst.Validation;         // PstHealth, PstValidator
using Bastion.Pst.Repair;             // PstRepair
using Bastion.Pst.Import;             // EmlReader, MsgReader, MboxReader, IcsReader, VcfReader, OlmReader, StoreImporter
using Bastion.Pst.Export;             // StoreBuilder, StoreExporter, MessageExporter, ItemExporter, ExportFormat
using Bastion.Pst.Authoring;          // ItemBuilder, Author, AuthoringSession
using Bastion.Pst.Diagnostics;        // DiagnosticsContext
CookbookRecipes
Reading stores Open a store, from a file or a stream; walk folders; read a message, its recipients and attachments; items by kind; search; check folder counts; tell ANSI from Unicode.
Showing a mailbox in your application Bindable rows for each section; list a folder and show one item; filter before opening; one card per person; progress events.
Merging, splitting and converting Merge two stores; Unified merges with duplicate removal; merge some item kinds; merge into volumes; check sources before merging; convert ANSI to Unicode; split by size or by rule; copy a folder tree.
Checking and repairing Health check and repair; repair directly; validate; passwords.
Importing and exporting Read EML and MSG, MBOX, ICS and VCF; import into a PST; import OLM; export a store or one item; export to text.
Creating and changing stores A new empty store; items from code; a recurring meeting; a whole mailbox in one pass; folders; several changes in one write; folder kinds; save, copy, move, delete and import as an application does.
Errors, progress and logs Error codes; progress and the user log; cancelling; partial results; ANSI stores.
Licensing and deployment The runtime key; a licensing refusal; the trial's limit; services, tests and build servers.
PowerShell Loading the library and calling it from a script.

Bastion PST SDK 3.0.0 › Cookbooks

Reading stores

Open a store, walk its folders, and read what is in them. Reading never changes the file.

Open a store

PersonalStorage.TryOpen returns the store or the reason it could not open it: a missing file, a file locked by Outlook, or one that is not a PST or OST. Open does the same and throws instead, which suits code that has already checked the file. Dispose the store when you are done; it holds the file open.

VB.NET

Dim opened = PersonalStorage.TryOpen("mail.pst")
If opened.ErrorCode <> ErrorCode.Ok Then
    Console.WriteLine(opened.ToString())        ' "code: description", fit to show a user
    Return
End If
Using store = opened.Store
    Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders")
End Using

C#

var opened = PersonalStorage.TryOpen("mail.pst");
if (opened.ErrorCode != ErrorCode.Ok)
{
    Console.WriteLine(opened.ToString());          // "code: description", fit to show a user
    return;
}
using (var store = opened.Store)
{
    Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders");
}

Open a store from a stream

Any readable, seekable stream works. leaveOpen decides whether disposing the store closes your stream.

VB.NET

' Any readable, seekable stream: a file you opened yourself, a memory stream, a download.
Using fs = File.OpenRead("mail.pst")
    Using store = PersonalStorage.Open(fs, leaveOpen:=True)
        Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders")
    End Using
End Using

C#

// Any readable, seekable stream: a file you opened yourself, a memory stream, a download.
using (var fs = File.OpenRead("mail.pst"))
using (var store = PersonalStorage.Open(fs, leaveOpen: true))
{
    Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders");
}

Walk the folders

A PST's folders hang under RootFolder. ContentCount is the count the file records; Messages() reads the items one at a time, so a large folder does not fill memory.

VB.NET

Sub ShowTree()
    Using store = PersonalStorage.Open("mail.pst")
        Walk(store.RootFolder, 0)
    End Using
End Sub

Sub Walk(folder As Folder, depth As Integer)
    Console.WriteLine(New String(" "c, depth * 2) & $"{folder.DisplayName} ({folder.ContentCount})")
    For Each m In folder.Messages()
        Console.WriteLine(New String(" "c, depth * 2 + 2) & "- " & m.Subject)
    Next
    For Each child In folder.SubFolders()
        Walk(child, depth + 1)
    Next
End Sub

C#

static void ShowTree()
{
    using (var store = PersonalStorage.Open("mail.pst"))
        Walk(store.RootFolder, 0);
}

static void Walk(Folder folder, int depth)
{
    Console.WriteLine(new string(' ', depth * 2) + $"{folder.DisplayName} ({folder.ContentCount})");
    foreach (var m in folder.Messages())
        Console.WriteLine(new string(' ', depth * 2 + 2) + "- " + m.Subject);
    foreach (var child in folder.SubFolders())
        Walk(child, depth + 1);
}

The tree includes the folders Outlook keeps for itself, such as the search root, and the root has no display name. An OST's folders sit under a mailbox root (Root - Mailbox\IPM_SUBTREE) rather than Top of Outlook data file.

Read a message: sender, recipients, body, attachments

VB.NET

' m is a PstMessage: from folder.Messages(), a search hit, or folder.OpenMessage(nid).
Console.WriteLine($"Subject : {m.Subject}")
Console.WriteLine($"From    : {m.SenderName} <{m.SenderEmail}>")
Console.WriteLine($"Sent    : {m.DeliveryTime}")
Console.WriteLine($"Unread  : {m.IsUnread}")
For Each r In m.Recipients
    Console.WriteLine($"  {r.RecipientType}: {r.DisplayName} <{r.Address}>")   ' SMTP if known
Next
Console.WriteLine(m.Body)
For Each a In m.Attachments
    Console.WriteLine($"  attachment: {a.FileName} ({a.Size:N0} bytes, {a.MimeTag})")
    Dim bytes = a.GetData()
    If bytes IsNot Nothing Then File.WriteAllBytes(a.FileName, bytes)     ' save it
Next

C#

// m is a PstMessage: from folder.Messages(), a search hit, or folder.OpenMessage(nid).
Console.WriteLine($"Subject : {m.Subject}");
Console.WriteLine($"From    : {m.SenderName} <{m.SenderEmail}>");
Console.WriteLine($"Sent    : {m.DeliveryTime}");
Console.WriteLine($"Unread  : {m.IsUnread}");
foreach (var r in m.Recipients)
    Console.WriteLine($"  {r.RecipientType}: {r.DisplayName} <{r.Address}>");   // SMTP if known
Console.WriteLine(m.Body);
foreach (var a in m.Attachments)
{
    Console.WriteLine($"  attachment: {a.FileName} ({a.Size:N0} bytes, {a.MimeTag})");
    var bytes = a.GetData();
    if (bytes != null) File.WriteAllBytes(a.FileName, bytes);     // save it
}

Recipient.Address is the SMTP address when the file has one and the stored address otherwise; SmtpAddress alone is empty for a recipient saved without one. Attachment.Size is the size Outlook records for the whole attachment, which is larger than its data.

Items of every kind

Every item has a Kind. Calendar and contact fields are on the message itself.

VB.NET

' folder is any Folder, such as one of store.RootFolder.SubFolders().
For Each m In folder.Messages()
    Select Case m.Kind
        Case ItemKind.Appointment
            Console.WriteLine($"Appointment: {m.Subject} {m.AppointmentStart:g}-{m.AppointmentEnd:t} at {m.Location}")
        Case ItemKind.Contact
            Console.WriteLine($"Contact: {m.Subject} {m.ContactEmail}")
        Case ItemKind.Mail
            Console.WriteLine($"Mail: {m.Subject}")
        Case Else
            Console.WriteLine($"{m.Kind}: {m.Subject}")
    End Select
Next

C#

// folder is any Folder, such as one of store.RootFolder.SubFolders().
foreach (var m in folder.Messages())
{
    switch (m.Kind)
    {
        case ItemKind.Appointment:
            Console.WriteLine($"Appointment: {m.Subject} {m.AppointmentStart:g}-{m.AppointmentEnd:t} at {m.Location}");
            break;
        case ItemKind.Contact:
            Console.WriteLine($"Contact: {m.Subject} {m.ContactEmail}");
            break;
        case ItemKind.Mail:
            Console.WriteLine($"Mail: {m.Subject}");
            break;
        default:
            Console.WriteLine($"{m.Kind}: {m.Subject}");
            break;
    }
}

MessageQuery builds a search; store.Search runs it over every folder and returns each hit with its folder path. For an application that lists mail, the queries in Showing a mailbox are faster: they reject rows before opening an item.

VB.NET

Using store = PersonalStorage.Open("mail.pst")
    Dim q = New MessageQuery().
        SubjectContains("invoice").
        SenderContains("acme.com").
        OfKind(ItemKind.Mail).
        WithAttachments()
    For Each hit In store.Search(q)
        Console.WriteLine($"{hit.FolderPath}\{hit.Message.Subject}")
    Next
End Using

C#

using (var store = PersonalStorage.Open("mail.pst"))
{
    var q = new MessageQuery()
        .SubjectContains("invoice")
        .SenderContains("acme.com")
        .OfKind(ItemKind.Mail)
        .WithAttachments();
    foreach (var hit in store.Search(q))
        Console.WriteLine($@"{hit.FolderPath}\{hit.Message.Subject}");
}

Check that each folder holds what it says

A damaged store can record a count its folder no longer holds. Compare the count with the items you can read.

VB.NET

' A folder's count is a property the file advertises; its rows are the mail.
' Compare the two to find a folder whose count lies.
Sub CheckCounts()
    Using store = PersonalStorage.Open("mail.pst")
        CheckFolder(store.RootFolder)
    End Using
End Sub

Sub CheckFolder(f As Folder)
    Dim advertised = f.ContentCount
    Dim actual = f.Messages().Count()
    If advertised <> actual Then Console.WriteLine($"MISMATCH {f.DisplayName}: says {advertised}, holds {actual}")
    For Each child In f.SubFolders()
        CheckFolder(child)
    Next
End Sub

C#

// A folder's count is a property the file advertises; its rows are the mail.
// Compare the two to find a folder whose count lies.
static void CheckCounts()
{
    using (var store = PersonalStorage.Open("mail.pst"))
        CheckFolder(store.RootFolder);
}

static void CheckFolder(Folder f)
{
    int advertised = f.ContentCount;
    int actual = f.Messages().Count();
    if (advertised != actual) Console.WriteLine($"MISMATCH {f.DisplayName}: says {advertised}, holds {actual}");
    foreach (var child in f.SubFolders())
        CheckFolder(child);
}

Tell a legacy ANSI file from a Unicode one

A check of the file header only. PeekFormat returns the format itself.

VB.NET

' A header-only check, before you offer to write to a file.
If PersonalStorage.IsAnsi("mail.pst") Then
    Console.WriteLine("Legacy ANSI file: readable; writing to it would convert it to Unicode.")
Else
    Console.WriteLine("Unicode file.")
End If

C#

// A header-only check, before you offer to write to a file.
if (PersonalStorage.IsAnsi("mail.pst"))
    Console.WriteLine("Legacy ANSI file: readable; writing to it would convert it to Unicode.");
else
    Console.WriteLine("Unicode file.");

Bastion PST SDK 3.0.0 › Cookbooks

Showing a mailbox in your application

What an application that shows a mailbox needs: lists to bind to, one item in full when the user picks it, filters that do not open every item, and progress while a big folder loads.

store.Views (StoreViews) returns plain rows: no open file handles and no reads left to happen later, so they are safe to keep and to bind. A damaged item gives a row with blank fields rather than an exception. Which folders hold contacts or feeds, and which are Outlook's hidden address-book folders, is decided here once rather than in every application.

One list per section

Mail, contacts, calendar, tasks, notes and RSS posts. RSS posts are a section of their own: Outlook files them under a variation of the mail folder class, so elsewhere they are counted as mail.

VB.NET

Using store = PersonalStorage.Open("mail.pst")
    For Each m In store.Views.Mail(New ItemQuery().Take(200))
        Console.WriteLine($"{m.FromDisplay}  {m.Display}  {m.Date:d}" &
                          If(m.IsUnread, "  unread", "") & If(m.HasAttachments, "  (attachment)", ""))
    Next
    For Each c In store.Views.Contacts()
        Console.WriteLine($"{c.Display}  {c.Email}  {c.Phone}")
    Next
    For Each a In store.Views.Appointments()
        Console.WriteLine($"{a.Display}  {a.StartTime:g}-{a.EndTime:t}  {a.Location}")
    Next
    For Each t In store.Views.Tasks()
        Console.WriteLine($"{t.Display}  {t.StatusText}  {t.PercentComplete:P0}" & If(t.IsOverdue, "  overdue", ""))
    Next
    For Each n In store.Views.Notes()
        Console.WriteLine(n.Display)
    Next
    For Each r In store.Views.Rss()
        Console.WriteLine($"[{r.FeedName}] {r.Display}")
    Next
End Using

C#

using (var store = PersonalStorage.Open("mail.pst"))
{
    foreach (var m in store.Views.Mail(new ItemQuery().Take(200)))
        Console.WriteLine($"{m.FromDisplay}  {m.Display}  {m.Date:d}"
                          + (m.IsUnread ? "  unread" : "") + (m.HasAttachments ? "  (attachment)" : ""));
    foreach (var c in store.Views.Contacts())
        Console.WriteLine($"{c.Display}  {c.Email}  {c.Phone}");
    foreach (var a in store.Views.Appointments())
        Console.WriteLine($"{a.Display}  {a.StartTime:g}-{a.EndTime:t}  {a.Location}");
    foreach (var t in store.Views.Tasks())
        Console.WriteLine($"{t.Display}  {t.StatusText}  {t.PercentComplete:P0}" + (t.IsOverdue ? "  overdue" : ""));
    foreach (var n in store.Views.Notes())
        Console.WriteLine(n.Display);
    foreach (var r in store.Views.Rss())
        Console.WriteLine($"[{r.FeedName}] {r.Display}");
}

Each row carries Nid, FolderPath, FolderNid and StorePath: enough to act on the item later without walking the tree again.

List one folder, then show the item the user picked

MailIn reads the folder's contents table and nothing else, so a folder of 23,000 messages costs one table read. Detail reads one item in full when the user selects it, and says which body to show. Attachment bytes are read only when the user saves or opens one.

VB.NET

' store is the open PersonalStorage; folder is the Folder the user clicked in your tree.

' The list: one read of the folder's contents table; no message is opened.
Dim rows = store.Views.MailIn(folder).ToList()

' The selection: everything needed to show one item.
Dim d = store.Views.Detail(folder, rows(0).Nid)
Console.WriteLine($"{d.Subject} - from {d.SenderName} <{d.SenderEmail}> to {d.DisplayTo}")
Dim body = If(d.HasHtml, d.BodyHtml, d.BodyPlain)

' Attachment bytes only when the user saves or opens one. Inline pictures belong to the body.
Directory.CreateDirectory("saved")
For Each a In d.Attachments.Where(Function(x) Not x.IsInline)
    Dim got = store.Views.TryAttachmentBytes(folder, d.Nid, a.Index)
    If got.ErrorCode = ErrorCode.Ok Then
        File.WriteAllBytes(Path.Combine("saved", a.FileName), got.Bytes)
    Else
        Console.WriteLine(got.ToString())
    End If
Next

C#

// store is the open PersonalStorage; folder is the Folder the user clicked in your tree.

// The list: one read of the folder's contents table; no message is opened.
var rows = store.Views.MailIn(folder).ToList();

// The selection: everything needed to show one item.
var d = store.Views.Detail(folder, rows[0].Nid);
Console.WriteLine($"{d.Subject} - from {d.SenderName} <{d.SenderEmail}> to {d.DisplayTo}");
var body = d.HasHtml ? d.BodyHtml : d.BodyPlain;

// Attachment bytes only when the user saves or opens one. Inline pictures belong to the body.
Directory.CreateDirectory("saved");
foreach (var a in d.Attachments.Where(x => !x.IsInline))
{
    var got = store.Views.TryAttachmentBytes(folder, d.Nid, a.Index);
    if (got.ErrorCode == ErrorCode.Ok)
        File.WriteAllBytes(Path.Combine("saved", a.FileName), got.Bytes);
    else
        Console.WriteLine(got.ToString());
}

Filter before an item is opened

A LINQ Where can only test an item after reading it. An ItemQuery tests the folder's contents table first — subject, sender, dates, size, read state, attachments — and opens only the rows that pass. Tests the table cannot answer, such as BodyContains, run afterwards on what is left, so put the cheap tests first.

VB.NET

Using store = PersonalStorage.Open("mail.pst")
    ' Answered from the folder's contents table: a row that fails is never opened.
    Dim cheap = New ItemQuery().
        SenderContains("acme").
        DateFrom(New Date(2024, 1, 1)).DateBefore(New Date(2025, 1, 1)).
        WithAttachments().
        Take(200)
    For Each m In store.Views.Mail(cheap)
        Console.WriteLine(m.Display)
    Next

    ' A body search needs the item, so it runs only on rows the table let through.
    Dim deeper = New ItemQuery().SubjectContains("invoice").BodyContains("overdue")
    Console.WriteLine($"{store.Views.Mail(deeper).Count()} overdue invoice(s)")

    ' Part of the tree only. A folder path is the full path a row's FolderPath shows,
    ' such as "Top of Outlook data file\Sent Items".
    Dim sent = store.Views.Mail(New ItemQuery().InFolders(Function(p) p.EndsWith("\Sent Items"))).ToList()
    Dim projects = store.Views.Mail(New ItemQuery().InFolders(Function(p) p.Contains("\Projects"))).ToList()
End Using

C#

using (var store = PersonalStorage.Open("mail.pst"))
{
    // Answered from the folder's contents table: a row that fails is never opened.
    var cheap = new ItemQuery()
        .SenderContains("acme")
        .DateFrom(new DateTime(2024, 1, 1)).DateBefore(new DateTime(2025, 1, 1))
        .WithAttachments()
        .Take(200);
    foreach (var m in store.Views.Mail(cheap))
        Console.WriteLine(m.Display);

    // A body search needs the item, so it runs only on rows the table let through.
    var deeper = new ItemQuery().SubjectContains("invoice").BodyContains("overdue");
    Console.WriteLine($"{store.Views.Mail(deeper).Count()} overdue invoice(s)");

    // Part of the tree only. A folder path is the full path a row's FolderPath shows,
    // such as "Top of Outlook data file\Sent Items".
    var sent = store.Views.Mail(new ItemQuery().InFolders(p => p.EndsWith(@"\Sent Items"))).ToList();
    var projects = store.Views.Mail(new ItemQuery().InFolders(p => p.Contains(@"\Projects"))).ToList();
}

InFolders receives each folder's full path, as a row's FolderPath shows it: Top of Outlook data file\Sent Items, not Sent Items. InFolder compares the whole path.

One card per person

An archive often holds the same person many times, each entry with different fields filled in. ContactMerger folds them into one card for display; nothing is written. Fields come from whichever entry has them, values that disagree are kept as alternates, and each card says how many entries it came from. A contact group is never folded into a person: its row has IsDistributionList set, with its Members.

VB.NET

Using store = PersonalStorage.Open("mail.pst")
    Dim stored = store.Views.Contacts().ToList()
    Dim people = ContactMerger.Combine(stored)        ' or CombineByEmail, to match on address
    Console.WriteLine($"{stored.Count} entries, {people.Count} cards")

    For Each p In people
        If p.IsDistributionList Then
            Console.WriteLine($"{p.Display} (group): {p.MembershipSummary}")
            Continue For
        End If
        Console.WriteLine($"{p.Display}  {p.Email}  {p.Phone}")
        If p.MergedFrom > 1 Then
            Console.WriteLine($"   from {p.MergedFrom} entries in {String.Join(", ", p.SourceFolders)}")
        End If
    Next
End Using

C#

using (var store = PersonalStorage.Open("mail.pst"))
{
    var stored = store.Views.Contacts().ToList();
    var people = ContactMerger.Combine(stored);        // or CombineByEmail, to match on address
    Console.WriteLine($"{stored.Count} entries, {people.Count} cards");

    foreach (var p in people)
    {
        if (p.IsDistributionList)
        {
            Console.WriteLine($"{p.Display} (group): {p.MembershipSummary}");
            continue;
        }
        Console.WriteLine($"{p.Display}  {p.Email}  {p.Phone}");
        if (p.MergedFrom > 1)
            Console.WriteLine($"   from {p.MergedFrom} entries in {string.Join(", ", p.SourceFolders)}");
    }
}

Outlook's hidden address-book folders (Recipient Cache, Suggested Contacts and others) are left out unless you set store.Views.IncludeHiddenFolders.

Progress from anywhere in the library

PstEvents.Default reports every store the library opens, each folder read with a real total, and every error, with nothing passed through your calls. Events arrive on the thread doing the work.

VB.NET

' One subscription hears every store the library opens, from any thread doing the work.
' A UI marshals to its own thread (Control.BeginInvoke) before touching a control.
AddHandler PstEvents.Default.PstOpen, Sub(s, e) Console.WriteLine($"opened {e.Path}")
AddHandler PstEvents.Default.PstFolderSelected, Sub(s, e) Console.WriteLine($"{e.Folder}: {e.ItemCount:N0} items")
AddHandler PstEvents.Default.PstRead, Sub(s, e) Console.Write($"{e.Percent}% ")
AddHandler PstEvents.Default.PstError, Sub(s, e) Console.WriteLine($"{e.ErrorCode}: {e.Message} ({e.Path})")
AddHandler PstEvents.Default.PstClose, Sub(s, e) Console.WriteLine("closed")

C#

// One subscription hears every store the library opens, from any thread doing the work.
// A UI marshals to its own thread (Control.BeginInvoke) before touching a control.
PstEvents.Default.PstOpen += (s, e) => Console.WriteLine($"opened {e.Path}");
PstEvents.Default.PstFolderSelected += (s, e) => Console.WriteLine($"{e.Folder}: {e.ItemCount:N0} items");
PstEvents.Default.PstRead += (s, e) => Console.Write($"{e.Percent}% ");
PstEvents.Default.PstError += (s, e) => Console.WriteLine($"{e.ErrorCode}: {e.Message} ({e.Path})");
PstEvents.Default.PstClose += (s, e) => Console.WriteLine("closed");

Bastion PST SDK 3.0.0 › Cookbooks

Merging, splitting and converting

Combine stores, split one, or bring a legacy ANSI file up to Unicode. The sources are only read; the output is a new file, checked before the call returns.

Merge two stores

The default layout is Stacked: each source keeps its own folder tree, under a folder named after it. Duplicates are removed within each source's tree only.

VB.NET

' Stacked (the default): each source keeps its own folder tree under a folder named after it.
Dim rep = StoreMerger.Merge({"a.pst", "b.pst"}, "merged.pst", dedup:=New Dedup(), overwrite:=True)
If rep.Succeeded Then
    Console.WriteLine($"{rep.MessagesMerged:N0} items merged, {rep.DuplicatesRemoved:N0} duplicates removed")
Else
    Console.WriteLine(rep.ToString())
End If

C#

// Stacked (the default): each source keeps its own folder tree under a folder named after it.
var rep = StoreMerger.Merge(new[] { "a.pst", "b.pst" }, "merged.pst", dedup: new Dedup(), overwrite: true);
if (rep.Succeeded)
    Console.WriteLine($"{rep.MessagesMerged:N0} items merged, {rep.DuplicatesRemoved:N0} duplicates removed");
else
    Console.WriteLine(rep.ToString());

One Inbox: a Unified merge with duplicates removed

Unified blends same-named folders, so every source's Inbox becomes one Inbox. A message found in two sources is then kept once. verify re-reads the output against the sources before the call returns.

Folders are matched by what they are for before their names: a source's wastebasket joins Deleted Items even when that source calls it Trash, Bin or Deleted Messages, and the same goes for Sent Items, the Calendar, Contacts, Tasks, Notes, the Journal, Drafts, the Outbox and Junk Email. Outlook's “(This computer only)” on an IMAP account's local folders is dropped, so “Calendar (This computer only)” and “Calendar” become one Calendar. A Stacked merge keeps every name as it was.

VB.NET

' Unified: same-named folders become one (one Inbox, one Sent Items...), and a message
' found in two sources is kept once.
Dim diag As New DiagnosticsContext With {.RecoverFromCorruption = True}
Dim rep = StoreMerger.Merge({"a.pst", "b.pst"}, "all-mail.pst",
                            dedup:=New Dedup(),
                            diag:=diag,
                            overwrite:=True,
                            layout:=MergeLayout.Unified,
                            rootName:="All Mail",          ' the name Outlook shows for the store
                            pruneEmpty:=True,              ' leave out folders that end up empty
                            verify:=True)                  ' re-read the output against the sources
Console.WriteLine(rep.ToString())

C#

// Unified: same-named folders become one (one Inbox, one Sent Items...), and a message
// found in two sources is kept once.
var diag = new DiagnosticsContext { RecoverFromCorruption = true };
var rep = StoreMerger.Merge(new[] { "a.pst", "b.pst" }, "all-mail.pst",
                            dedup: new Dedup(),
                            diag: diag,
                            overwrite: true,
                            layout: MergeLayout.Unified,
                            rootName: "All Mail",          // the name Outlook shows for the store
                            pruneEmpty: true,              // leave out folders that end up empty
                            verify: true);                 // re-read the output against the sources
Console.WriteLine(rep.ToString());

The options

ParameterDefaultEffect
dedupnonePass a Dedup to remove duplicate email, matched by Internet Message-ID, or, when there is none, by subject, sender name and delivery time (Outlook's hidden marker at the start of a stored subject is ignored). Only email is checked: contacts, appointments, tasks, notes and journal entries are always kept. The first copy is kept. A duplicate is one in the same destination folder; set Dedup.AcrossFolders to keep one copy in the whole output, which empties folders whose mail was filed elsewhere too. DiagnosticsContext.SkipDuplicates runs this same check.
keepKindsallOnly these item kinds.
diagnoneProgress, the user log, cancellation, corruption recovery.
overwriteFalseReplace the output file if it exists.
maxBytes0Refuse output larger than this; 0 means the format's own limit.
layoutStackedStacked or Unified.
rootName“Stacked Merge” or “Unified Merge”The name Outlook shows for the store; up to 200 characters.
pruneEmptyFalseLeave out folders that end up empty. Outlook's special folders (Inbox, Deleted Items, Sent Items, the Calendar and the rest) are always kept, because the store points to them.
dropBlankMessagesTrueLeave out email with no subject, no body (plain, HTML or RTF) and no attachment; each is listed in the user log. Other items, such as contacts and appointments, are never left out this way.
verifyFalseRe-read the output against the sources.

Search folders are never copied: they are saved searches over other folders, whose mail is merged.

Merge only some kinds of item

VB.NET

' Only mail and calendar items; contacts, tasks and notes are left out.
Dim keep As New HashSet(Of ItemKind) From {ItemKind.Mail, ItemKind.Appointment}
Dim rep = StoreMerger.Merge({"a.pst", "b.pst"}, "mail-and-calendar.pst", keepKinds:=keep, overwrite:=True)
Console.WriteLine(rep.ToString())

C#

// Only mail and calendar items; contacts, tasks and notes are left out.
var keep = new HashSet<ItemKind> { ItemKind.Mail, ItemKind.Appointment };
var rep = StoreMerger.Merge(new[] { "a.pst", "b.pst" }, "mail-and-calendar.pst", keepKinds: keep, overwrite: true);
Console.WriteLine(rep.ToString());

Merge into files of a set size

When the output would be too big for one file, or too big to handle, write volumes of at most a given size. Whole sources go into each volume, in the order given, and a volume is filled to about 85% of the size so the file's own structure fits within it; a single source too big for one volume is split by message. With more than one volume, each store is named “<name> (volume 2)” and so on, so Outlook can tell them apart. Duplicates are found across the whole set before it is divided.

VB.NET

' Output split into files of at most 10 GB: archive.pst, then numbered volumes beside it.
Dim vol = StoreMerger.MergeToVolumes({"big1.pst", "big2.pst"}, "archive.pst",
                                     capBytes:=10L * 1024 * 1024 * 1024, overwrite:=True)
For Each v In vol.Volumes
    Console.WriteLine($"{v.Path}: {v.Messages:N0} messages")
Next

C#

// Output split into files of at most 10 GB: archive.pst, then numbered volumes beside it.
var vol = StoreMerger.MergeToVolumes(new[] { "big1.pst", "big2.pst" }, "archive.pst",
                                     capBytes: 10L * 1024 * 1024 * 1024, overwrite: true);
foreach (var v in vol.Volumes)
    Console.WriteLine($"{v.Path}: {v.Messages:N0} messages");

Check the sources before merging

MergePreflight looks at every source first, so an application can ask once about the damaged ones rather than fail half-way. Repaired copies go into a work folder; the originals are not changed.

VB.NET

' Look at every source first; repair the damaged ones into a work folder, then merge.
Dim sources = New List(Of String) From {"a.pst", "b.pst"}
Dim scan = MergePreflight.Scan(sources)
Console.WriteLine($"{scan.CorruptCount} of {sources.Count} sources need repair")

If scan.CorruptCount > 0 Then
    ' Ask once; RepairChoice.YesToAll stops the asking.
    scan = MergePreflight.Repair(scan, "repaired",
                                 Function(file, n, total) RepairChoice.YesToAll)
End If

C#

// Look at every source first; repair the damaged ones into a work folder, then merge.
var sources = new List<string> { "a.pst", "b.pst" };
var scan = MergePreflight.Scan(sources);
Console.WriteLine($"{scan.CorruptCount} of {sources.Count} sources need repair");

if (scan.CorruptCount > 0)
{
    // Ask once; RepairChoice.YesToAll stops the asking.
    scan = MergePreflight.Repair(scan, "repaired",
                                 (file, n, total) => RepairChoice.YesToAll);
}

ScanAndRepairAll does both steps without asking.

Convert a legacy ANSI store to Unicode

Compiled, not run: the test needs an ANSI store, which this library cannot write.

VB.NET

Dim res = StoreConverter.ConvertToUnicode("old-ansi.pst", "unicode.pst", New DiagnosticsContext(), overwrite:=True)
Console.WriteLine(If(res.ErrorCode = ErrorCode.Ok, "Converted.", res.ToString()))

C#

var res = StoreConverter.ConvertToUnicode("old-ansi.pst", "unicode.pst", new DiagnosticsContext(), overwrite: true);
Console.WriteLine(res.ErrorCode == ErrorCode.Ok ? "Converted." : res.ToString());

Split a store

By size, into numbered parts:

VB.NET

' Parts of at most 2 GB each, written into the folder "parts".
Dim rep = StoreSplitter.SplitBySize("big.pst", "parts", 2L * 1024 * 1024 * 1024, overwrite:=True)
For Each p In rep.Parts
    Console.WriteLine($"{p.Path}: {p.MessageCount:N0} messages")
Next

C#

// Parts of at most 2 GB each, written into the folder "parts".
var rep = StoreSplitter.SplitBySize("big.pst", "parts", 2L * 1024 * 1024 * 1024, overwrite: true);
foreach (var p in rep.Parts)
    Console.WriteLine($"{p.Path}: {p.MessageCount:N0} messages");

Or by any rule over each message: the matches into one file, the rest into another.

VB.NET

' Everything whose subject mentions an invoice into one file, the rest into another.
Dim isInvoice As Func(Of PstMessage, Boolean) =
    Function(m) If(m.Subject, "").IndexOf("invoice", StringComparison.OrdinalIgnoreCase) >= 0
Dim rep = StoreSplitter.SplitByPredicate("big.pst", "invoices.pst", "rest.pst", isInvoice, overwrite:=True)
Console.WriteLine(rep.ToString())

C#

// Everything whose subject mentions an invoice into one file, the rest into another.
Func<PstMessage, bool> isInvoice =
    m => (m.Subject ?? "").IndexOf("invoice", StringComparison.OrdinalIgnoreCase) >= 0;
var rep = StoreSplitter.SplitByPredicate("big.pst", "invoices.pst", "rest.pst", isInvoice, overwrite: true);
Console.WriteLine(rep.ToString());

Copy a folder tree without its items

VB.NET

' A new, empty PST with the same folder tree as the source; no items are copied.
Dim rep = Import.StoreImporter.CloneStructure("live.pst", "template.pst", overwrite:=True)
Console.WriteLine($"{rep.FoldersCreated} folders created")

C#

// A new, empty PST with the same folder tree as the source; no items are copied.
var rep = StoreImporter.CloneStructure("live.pst", "template.pst", overwrite: true);
Console.WriteLine($"{rep.FoldersCreated} folders created");

On a trial

During the 30-day trial a merge, a volume merge or a pre-merge scan takes at most two PST or OST files. See the trial's limit.

Bastion PST SDK 3.0.0 › Cookbooks

Checking and repairing

Find damage, rebuild a damaged store into a new file, check a store's structure the way Outlook would, and manage the store password.

Check a store, and repair it if it is damaged

PstHealth.Check reads the file's structure and folder counts. If it finds damage, RepairTo rebuilds the store into a new file, and SaveSupportReport writes a report of the file's structure, with no message content, that a user can send you.

VB.NET

Dim health = PstHealth.Check("mail.pst")
If health.ErrorCode <> ErrorCode.Ok Then
    Console.WriteLine(health.ToString())
    Return
End If

If health.IsCorrupted Then
    ' A report of the file's structure only - no message content - safe for a user to send you.
    Dim report = health.SaveSupportReport()
    Console.WriteLine("Support report: " & report.Path)

    Dim fix = health.RepairTo("mail-repaired.pst")
    Console.WriteLine(If(fix.Succeeded, "Repaired into mail-repaired.pst", fix.ToString()))
Else
    Console.WriteLine("No damage found.")
End If

C#

var health = PstHealth.Check("mail.pst");
if (health.ErrorCode != ErrorCode.Ok)
{
    Console.WriteLine(health.ToString());
    return;
}

if (health.IsCorrupted)
{
    // A report of the file's structure only - no message content - safe for a user to send you.
    var report = health.SaveSupportReport();
    Console.WriteLine("Support report: " + report.Path);

    var fix = health.RepairTo("mail-repaired.pst");
    Console.WriteLine(fix.Succeeded ? "Repaired into mail-repaired.pst" : fix.ToString());
}
else
{
    Console.WriteLine("No damage found.");
}

Repair directly

PstRepair.Repair gives the full report. Succeeded is true only when the new file passes strict validation. When some content could not be carried over, the result says what and where; the original is never changed.

VB.NET

' The original is never changed; the repaired copy is validated before Succeeded is True.
Dim diag As New DiagnosticsContext With {.CreateUserLog = True}
Dim rep = PstRepair.Repair("damaged.pst", "repaired.pst", diag, overwrite:=True)
Console.WriteLine(rep.ToString())
If rep.Succeeded Then Console.WriteLine($"{rep.NodesWritten:N0} items written")

C#

// The original is never changed; the repaired copy is validated before Succeeded is true.
var diag = new DiagnosticsContext { CreateUserLog = true };
var rep = PstRepair.Repair("damaged.pst", "repaired.pst", diag, overwrite: true);
Console.WriteLine(rep.ToString());
if (rep.Succeeded) Console.WriteLine($"{rep.NodesWritten:N0} items written");

Validate a store's structure

Checks every page and block the way Outlook reads them, without starting Outlook.

VB.NET

Dim v = PstValidator.Validate("mail.pst")
If v Is Nothing Then
    Console.WriteLine("Not checked: the header could not be read.")
ElseIf v.IsValid Then
    Console.WriteLine($"Valid: {v.PagesChecked:N0} pages and {v.BlocksChecked:N0} blocks checked.")
Else
    Console.WriteLine($"{v.ErrorCount} problem(s):")
    For Each grp In v.Issues.GroupBy(Function(i) i.Category)
        Console.WriteLine($"  {grp.Key} x{grp.Count()}: {grp.First().Message}")
    Next
End If

C#

var v = PstValidator.Validate("mail.pst");
if (v == null)
    Console.WriteLine("Not checked: the header could not be read.");
else if (v.IsValid)
    Console.WriteLine($"Valid: {v.PagesChecked:N0} pages and {v.BlocksChecked:N0} blocks checked.");
else
{
    Console.WriteLine($"{v.ErrorCount} problem(s):");
    foreach (var grp in v.Issues.GroupBy(i => i.Category))
        Console.WriteLine($"  {grp.Key} x{grp.Count()}: {grp.First().Message}");
}

The store password

A PST password is not encryption. Outlook stores a checksum of it and asks for it when the store is opened; this library reads the store either way. StorePassword reads that state, sets or removes it, and computes the checksum Outlook would store, so you can check a typed password.

VB.NET

' A PST password is not encryption: Outlook keeps a CRC of it and asks for it on opening.
Dim status = StorePassword.GetStatus("mail.pst")
If status.ErrorCode <> ErrorCode.Ok Then Console.WriteLine(status.ToString()) : Return
Console.WriteLine(If(status.HasPassword, "Password set.", "No password."))

' Check what the user typed, without changing the file.
If status.HasPassword AndAlso StorePassword.ComputeCrc(userTyped) = status.PasswordCrc Then
    Console.WriteLine("Correct password.")
End If

' Set one (writes locked.pst; mail.pst is not changed)...
Dim setRep = StorePassword.SetPassword("mail.pst", "locked.pst", "s3cret!", overwrite:=True)
Console.WriteLine(setRep.ToString())

' ...and remove it again, in place.
Dim removeRep = StorePassword.RemovePassword("locked.pst", "locked.pst", overwrite:=True)
Console.WriteLine(removeRep.ToString())

C#

// A PST password is not encryption: Outlook keeps a CRC of it and asks for it on opening.
var status = StorePassword.GetStatus("mail.pst");
if (status.ErrorCode != ErrorCode.Ok) { Console.WriteLine(status.ToString()); return; }
Console.WriteLine(status.HasPassword ? "Password set." : "No password.");

// Check what the user typed, without changing the file.
if (status.HasPassword && StorePassword.ComputeCrc(userTyped) == status.PasswordCrc)
    Console.WriteLine("Correct password.");

// Set one (writes locked.pst; mail.pst is not changed)...
var setRep = StorePassword.SetPassword("mail.pst", "locked.pst", "s3cret!", overwrite: true);
Console.WriteLine(setRep.ToString());

// ...and remove it again, in place.
var removeRep = StorePassword.RemovePassword("locked.pst", "locked.pst", overwrite: true);
Console.WriteLine(removeRep.ToString());

The same path for source and output, with overwrite set, changes the file in place.

Bastion PST SDK 3.0.0 › Cookbooks

Importing and exporting

Read interchange files into a neutral item model, write them into a PST, and get items out of a PST as files or text.

FormatReadInto a PSTOut of a PST
EML (MIME)EmlReaderStoreImporter.ImportFilesMessageExporter.ExportEml, ExportFormat.Eml
MSG (Outlook)MsgReaderStoreImporter.ImportFilesMessageExporter.ExportMsg, ExportFormat.Msg
OFT (Outlook template)——MessageExporter.ExportOft
MHTML——MessageExporter.ExportMhtml, ExportFormat.Mhtml
MBOXMboxReaderStoreImporter.ImportMboxExportFormat.Mbox
ICS (iCalendar)IcsReaderItemOps.ImportFilesItemExporter.ExportIcs, ExportFormat.Ics
VCF (vCard)VcfReaderItemOps.ImportFilesItemExporter.ExportVcf, ExportFormat.Vcf
OLM (Outlook for Mac)OlmReaderStoreImporter.ImportOlm—

Read an EML or MSG file

A reader returns an ImportedMessage: headers, addresses, both bodies and the attachments' bytes. A file it cannot read gives a result with the reason, not an exception.

VB.NET

Dim res = EmlReader.ParseFile("message.eml")       ' or MsgReader.ParseFile("message.msg")
If res.ErrorCode <> ErrorCode.Ok Then
    Console.WriteLine(res.ToString())
    Return
End If
Dim m = res.Message
Console.WriteLine($"{m.Subject} - from {m.FromEmail}, {m.To.Count} recipient(s), {m.Attachments.Count} attachment(s)")
For Each a In m.Attachments
    File.WriteAllBytes(a.FileName, a.Data)            ' save each attachment
Next

C#

var res = EmlReader.ParseFile("message.eml");       // or MsgReader.ParseFile("message.msg")
if (res.ErrorCode != ErrorCode.Ok)
{
    Console.WriteLine(res.ToString());
    return;
}
var m = res.Message;
Console.WriteLine($"{m.Subject} - from {m.FromEmail}, {m.To.Count} recipient(s), {m.Attachments.Count} attachment(s)");
foreach (var a in m.Attachments)
    File.WriteAllBytes(a.FileName, a.Data);            // save each attachment

Read an MBOX file

Each multi-item reader has two forms. TryReadFile reads the whole file and reports what could not be read; ReadFile streams the items and stops at a file it cannot read.

VB.NET

' TryReadFile reads the whole file and says what went wrong; ReadFile streams and stops at a bad file.
Dim res = MboxReader.TryReadFile("archive.mbox")
If res.ErrorCode <> ErrorCode.Ok Then Console.WriteLine(res.ToString())
For Each m In res.Messages
    Console.WriteLine($"{m.Date:d}  {m.FromEmail}  {m.Subject}")
Next
Console.WriteLine($"{res.Messages.Count} read, {res.EntriesFailed} could not be read")

C#

// TryReadFile reads the whole file and says what went wrong; ReadFile streams and stops at a bad file.
var res = MboxReader.TryReadFile("archive.mbox");
if (res.ErrorCode != ErrorCode.Ok) Console.WriteLine(res.ToString());
foreach (var m in res.Messages)
    Console.WriteLine($"{m.Date:d}  {m.FromEmail}  {m.Subject}");
Console.WriteLine($"{res.Messages.Count} read, {res.EntriesFailed} could not be read");

Read calendar and contact files

VB.NET

' The same shape for every format: calendar (.ics), contacts (.vcf), Outlook for Mac (.olm).
For Each res In {IcsReader.TryReadFile("event.ics"), VcfReader.TryReadFile("card.vcf")}
    For Each item In res.Messages
        Console.WriteLine($"{item.Kind}: {item.Subject}")
    Next
Next

C#

// The same shape for every format: calendar (.ics), contacts (.vcf), Outlook for Mac (.olm).
foreach (var res in new[] { IcsReader.TryReadFile("event.ics"), VcfReader.TryReadFile("card.vcf") })
    foreach (var item in res.Messages)
        Console.WriteLine($"{item.Kind}: {item.Subject}");

Import an MBOX file into a new PST

Pass Nothing (null) as the store to start a new one. The folder path is created if it is missing; / separates levels.

VB.NET

' Nothing as the first argument: start a new store. Folder paths are created as needed.
Dim rep = StoreImporter.ImportMbox(Nothing, "archive.pst", "archive.mbox", "Imported/2024",
                                   overwrite:=True, storeName:="2024 Mail Archive")
Console.WriteLine(rep.ToString())

C#

// null as the first argument: start a new store. Folder paths are created as needed.
var rep = StoreImporter.ImportMbox(null, "archive.pst", "archive.mbox", "Imported/2024",
                                   overwrite: true, storeName: "2024 Mail Archive");
Console.WriteLine(rep.ToString());

Import EML and MSG files into an existing store

The store is read and the result written to a new file. Folder counts are kept right, and the output is opened again to check it before the call returns.

VB.NET

' EML and MSG files into an existing store's Inbox. mail.pst is read; the result is out.pst.
Dim files = Directory.GetFiles("mails", "*.eml")
Dim rep = StoreImporter.ImportFiles("mail.pst", "out.pst", files, "Inbox", overwrite:=True)
Console.WriteLine(rep.ToString())
For Each line In rep.Failures
    Console.WriteLine("  " & line)                  ' one line per file that could not be read
Next

C#

// EML and MSG files into an existing store's Inbox. mail.pst is read; the result is out.pst.
var files = Directory.GetFiles("mails", "*.eml");
var rep = StoreImporter.ImportFiles("mail.pst", "out.pst", files, "Inbox", overwrite: true);
Console.WriteLine(rep.ToString());
foreach (var line in rep.Failures)
    Console.WriteLine("  " + line);                  // one line per file that could not be read

Import an Outlook for Mac archive

Compiled, not run: the test needs an OLM archive.

VB.NET

' An Outlook for Mac archive into a new PST, keeping its folders.
Dim rep = StoreImporter.ImportOlm("MacExport.olm", "converted.pst", overwrite:=True)
Console.WriteLine($"{rep.MessagesImported} items into {rep.FoldersCreated} folders")

C#

// An Outlook for Mac archive into a new PST, keeping its folders.
var rep = StoreImporter.ImportOlm("MacExport.olm", "converted.pst", overwrite: true);
Console.WriteLine($"{rep.MessagesImported} items into {rep.FoldersCreated} folders");

Export a whole store as files

A folder tree on disk that mirrors the store's, one file per item, or one MBOX file per folder.

VB.NET

' The whole store as files in a folder tree that mirrors its folders.
Dim rep = StoreExporter.ExportToFolder("mail.pst", "exported", ExportFormat.Eml,
                                       New DiagnosticsContext(), overwrite:=True)
Console.WriteLine($"{rep.FilesWritten:N0} files written, {rep.Failed:N0} not")
' ExportFormat.Msg, Mhtml, Mbox (one file per folder), Ics (calendar items), Vcf (contacts)

C#

// The whole store as files in a folder tree that mirrors its folders.
var rep = StoreExporter.ExportToFolder("mail.pst", "exported", ExportFormat.Eml,
                                       new DiagnosticsContext(), overwrite: true);
Console.WriteLine($"{rep.FilesWritten:N0} files written, {rep.Failed:N0} not");
// ExportFormat.Msg, Mhtml, Mbox (one file per folder), Ics (calendar items), Vcf (contacts)

Export one item

VB.NET

' m, appointment and contact are PstMessage items read from a store.
MessageExporter.ExportEml(m, "message.eml")              ' MIME, opens in any mail program
MessageExporter.ExportMsg(m, "message.msg")              ' Outlook's own format
MessageExporter.ExportMhtml(m, "message.mhtml")          ' a web page with its pictures
ItemExporter.ExportIcs(appointment, "event.ics")         ' iCalendar
ItemExporter.ExportVcf(contact, "card.vcf")              ' vCard 3.0

' Each returns a result; check it when the file matters.
Dim res = MessageExporter.ExportEml(m, "copy.eml", overwrite:=False)
If res.ErrorCode <> ErrorCode.Ok Then Console.WriteLine(res.ToString())

C#

// m, appointment and contact are PstMessage items read from a store.
MessageExporter.ExportEml(m, "message.eml");              // MIME, opens in any mail program
MessageExporter.ExportMsg(m, "message.msg");              // Outlook's own format
MessageExporter.ExportMhtml(m, "message.mhtml");          // a web page with its pictures
ItemExporter.ExportIcs(appointment, "event.ics");         // iCalendar
ItemExporter.ExportVcf(contact, "card.vcf");              // vCard 3.0

// Each returns a result; check it when the file matters.
var res = MessageExporter.ExportEml(m, "copy.eml", overwrite: false);
if (res.ErrorCode != ErrorCode.Ok) Console.WriteLine(res.ToString());

To save a user's selection of mixed items, each in its own natural format, use ItemOps.SaveItems (Creating and changing stores).

Export to text

TryToEml, TryToMhtml, ItemExporter.TryToIcs and TryToVcf return the text with the outcome, for an item you want to store or send without writing a file.

VB.NET

' m is a PstMessage read from a store.
' The same formats as text, to store or send without touching the disk.
Dim eml = MessageExporter.TryToEml(m)
If eml.ErrorCode = ErrorCode.Ok Then
    Console.WriteLine($"{eml.Text.Length:N0} characters of MIME")
Else
    Console.WriteLine(eml.ToString())
End If

C#

// m is a PstMessage read from a store.
// The same formats as text, to store or send without touching the disk.
var eml = MessageExporter.TryToEml(m);
if (eml.ErrorCode == ErrorCode.Ok)
    Console.WriteLine($"{eml.Text.Length:N0} characters of MIME");
else
    Console.WriteLine(eml.ToString());

Bastion PST SDK 3.0.0 › Cookbooks

Creating and changing stores

New stores, items built in code, folders, and the edits an application makes. Every write reads the source and writes a new file, which is opened again and checked before the call returns.

A new, empty store

VB.NET

' storeName is the name Outlook shows for the store; leave it out for "Outlook Data File".
Dim res = StoreBuilder.CreateEmpty("new.pst", overwrite:=True, storeName:="My Archive")
Console.WriteLine(If(res.ErrorCode = ErrorCode.Ok, "Created " & res.Path, res.ToString()))

C#

// storeName is the name Outlook shows for the store; leave it out for "Outlook Data File".
var res = StoreBuilder.CreateEmpty("new.pst", overwrite: true, storeName: "My Archive");
Console.WriteLine(res.ErrorCode == ErrorCode.Ok ? "Created " + res.Path : res.ToString());

Items from code

ItemBuilder makes every kind of item: mail, appointments, contacts, tasks, notes, journal entries, contact groups and RSS posts. Author puts them in a new store or adds them to one.

VB.NET

Dim mail = ItemBuilder.Mail().
    Subject("Welcome").From("Team", "team@example.com").[To]("Ada", "ada@example.com").
    BodyText("Hello!").AddAttachment("logo.png", File.ReadAllBytes("logo.png"), "image/png").
    Build()
Dim contact = ItemBuilder.Contact().
    Name("Ada", "Lovelace").Company("Analytical Engines").
    Email("ada@example.com").Phone(business:="+44 20 7946 0001").
    Build()
Dim list = ItemBuilder.DistributionList().Name("Team").
    AddMember("Ada Lovelace", "ada@example.com").AddMember("Alan Turing", "alan@example.com").
    Build()

' A new store with the mail in its Inbox.
Dim created = Author.CreateStoreWith("new.pst", {mail}, "Inbox", storeName:="My Data", overwrite:=True)
Console.WriteLine(created.ToString())

' Add to it: new.pst is read and the result written to a new file. A missing folder is made,
' with the class its items need (here, a contacts folder).
Dim added = Author.AddItems("new.pst", "my-data.pst", {contact, list}, "Contacts", overwrite:=True)
Console.WriteLine(added.ToString())

C#

var mail = ItemBuilder.Mail()
    .Subject("Welcome").From("Team", "team@example.com").To("Ada", "ada@example.com")
    .BodyText("Hello!").AddAttachment("logo.png", File.ReadAllBytes("logo.png"), "image/png")
    .Build();
var contact = ItemBuilder.Contact()
    .Name("Ada", "Lovelace").Company("Analytical Engines")
    .Email("ada@example.com").Phone(business: "+44 20 7946 0001")
    .Build();
var list = ItemBuilder.DistributionList().Name("Team")
    .AddMember("Ada Lovelace", "ada@example.com").AddMember("Alan Turing", "alan@example.com")
    .Build();

// A new store with the mail in its Inbox.
var created = Author.CreateStoreWith("new.pst", new[] { mail }, "Inbox", storeName: "My Data", overwrite: true);
Console.WriteLine(created.ToString());

// Add to it: new.pst is read and the result written to a new file. A missing folder is made,
// with the class its items need (here, a contacts folder).
var added = Author.AddItems("new.pst", "my-data.pst", new[] { contact, list }, "Contacts", overwrite: true);
Console.WriteLine(added.ToString());

A recurring meeting, with one occurrence moved and one cancelled

An exception date must fall on an occurrence of the series; the builder refuses one that does not, rather than write a calendar Outlook would misread.

VB.NET

Dim first = New Date(2026, 1, 6, 10, 0, 0, DateTimeKind.Utc)          ' a Tuesday
Dim meeting = ItemBuilder.Appointment().
    Subject("Design review").Location("Room 2").
    StartsAt(first).EndsAt(first.AddHours(1)).
    Organiser("Dana Ruiz", "dana@example.com").
    Attendee("You", "you@example.com").OptionalAttendee("Sam Okafor", "sam@example.com").
    Reminder(15).
    RecurWeekly(RecurDays.Tuesday, occurrences:=8).
    ModifyOccurrence(first.AddDays(7), newStart:=first.AddDays(7).AddHours(4)).  ' one moved to 14:00
    ExcludeOccurrences(first.AddDays(14)).                                       ' one cancelled
    Build()
Dim rep = Author.CreateStoreWith("calendar.pst", {meeting}, "Calendar", overwrite:=True)
Console.WriteLine(rep.ToString())

C#

var first = new DateTime(2026, 1, 6, 10, 0, 0, DateTimeKind.Utc);       // a Tuesday
var meeting = ItemBuilder.Appointment()
    .Subject("Design review").Location("Room 2")
    .StartsAt(first).EndsAt(first.AddHours(1))
    .Organiser("Dana Ruiz", "dana@example.com")
    .Attendee("You", "you@example.com").OptionalAttendee("Sam Okafor", "sam@example.com")
    .Reminder(15)
    .RecurWeekly(RecurDays.Tuesday, occurrences: 8)
    .ModifyOccurrence(first.AddDays(7), newStart: first.AddDays(7).AddHours(4))  // one moved to 14:00
    .ExcludeOccurrences(first.AddDays(14))                                      // one cancelled
    .Build();
var rep = Author.CreateStoreWith("calendar.pst", new[] { meeting }, "Calendar", overwrite: true);
Console.WriteLine(rep.ToString());

A whole mailbox in one pass

Each item names its folder in SourceFolder, and StoreImporter.ImportMessagesByFolder writes them all in one rewrite. One call per folder would rewrite the store once per folder.

VB.NET

' Every item says which folder it belongs in; one call writes them all in one pass.
Dim items As New List(Of ImportedMessage)()

Dim mail = ItemBuilder.Mail().Subject("Q3 numbers").From("Dana Ruiz", "dana@example.com").
    [To]("You", "you@example.com").BodyHtml("<p>Attached.</p>").SentOn(Date.Now.AddDays(-2)).
    Read(False).Importance(2).Build()                        ' unread, high importance
mail.SourceFolder = "Inbox"
items.Add(mail)

Dim contact = ItemBuilder.Contact().Name("Sam", "Okafor").Company("Example Ltd").JobTitle("Architect").
    Email("sam@example.com").Phone(business:="+44 20 7946 0000", mobile:="+44 7700 900000").
    Photo(File.ReadAllBytes("sam.jpg")).Build()                ' the picture on the card
contact.SourceFolder = "Contacts"
items.Add(contact)

Dim post = ItemBuilder.Rss().Subject("Release 3.1 is out").
    Channel("Example Blog", "https://example.com/feed").Article("https://example.com/3-1").
    PostedOn(Date.Now.AddDays(-1)).Read(False).Build()
post.SourceFolder = "RSS Feeds\Example Blog"
items.Add(post)

Dim task = ItemBuilder.Task().Subject("Ship version 1").Status(1).PercentComplete(0.5).
    DueDate(Date.Today.AddDays(30)).Build()                   ' Status 1: in progress
task.SourceFolder = "Tasks"
items.Add(task)

Dim note = ItemBuilder.Note().Text("Remember the milk").Build()
note.SourceFolder = "Notes"
items.Add(note)

' extraFolders are created empty, ready for the user.
Dim rep = StoreImporter.ImportMessagesByFolder(Nothing, "mailbox.pst", items,
              defaultFolder:="Inbox", extraFolders:={"Journal", "Archive"},
              diag:=New DiagnosticsContext(), overwrite:=True, storeName:="My Mailbox")
Console.WriteLine(rep.ToString())

C#

// Every item says which folder it belongs in; one call writes them all in one pass.
var items = new List<ImportedMessage>();

var mail = ItemBuilder.Mail().Subject("Q3 numbers").From("Dana Ruiz", "dana@example.com")
    .To("You", "you@example.com").BodyHtml("<p>Attached.</p>").SentOn(DateTime.Now.AddDays(-2))
    .Read(false).Importance(2).Build();                       // unread, high importance
mail.SourceFolder = "Inbox";
items.Add(mail);

var contact = ItemBuilder.Contact().Name("Sam", "Okafor").Company("Example Ltd").JobTitle("Architect")
    .Email("sam@example.com").Phone(business: "+44 20 7946 0000", mobile: "+44 7700 900000")
    .Photo(File.ReadAllBytes("sam.jpg")).Build();               // the picture on the card
contact.SourceFolder = "Contacts";
items.Add(contact);

var post = ItemBuilder.Rss().Subject("Release 3.1 is out")
    .Channel("Example Blog", "https://example.com/feed").Article("https://example.com/3-1")
    .PostedOn(DateTime.Now.AddDays(-1)).Read(false).Build();
post.SourceFolder = @"RSS Feeds\Example Blog";
items.Add(post);

var task = ItemBuilder.Task().Subject("Ship version 1").Status(1).PercentComplete(0.5)
    .DueDate(DateTime.Today.AddDays(30)).Build();                  // Status 1: in progress
task.SourceFolder = "Tasks";
items.Add(task);

var note = ItemBuilder.Note().Text("Remember the milk").Build();
note.SourceFolder = "Notes";
items.Add(note);

// extraFolders are created empty, ready for the user.
var rep = StoreImporter.ImportMessagesByFolder(null, "mailbox.pst", items,
              defaultFolder: "Inbox", extraFolders: new[] { "Journal", "Archive" },
              diag: new DiagnosticsContext(), overwrite: true, storeName: "My Mailbox");
Console.WriteLine(rep.ToString());

Create a folder

VB.NET

' "/" separates levels; every missing level is created.
Dim rep = Author.CreateFolder("data.pst", "out.pst", "Projects/2026/Client A", overwrite:=True)
Console.WriteLine(rep.ToString())

C#

// "/" separates levels; every missing level is created.
var rep = Author.CreateFolder("data.pst", "out.pst", "Projects/2026/Client A", overwrite: true);
Console.WriteLine(rep.ToString());

Several changes in one write

An AuthoringSession collects folder renames, moves, deletions, class changes and item edits, and writes them in one rewrite on Commit. Creating folders and adding items are not session changes: use Author.CreateFolder and Author.AddItems first.

VB.NET

' Several changes, one rewrite of the file. The source is read; the result is out.pst.
Dim rep = New AuthoringSession("data.pst").
    RenameFolder("Old", "Old Mail").
    SetFolderClass("Archive", FolderClass.Mail).
    DeleteItems("Spam", Function(m) m.Subject.Contains("[AD]")).
    Commit("out.pst", overwrite:=True)
Console.WriteLine(rep.ToString())                       ' ErrorCode 0: every change applied

C#

// Several changes, one rewrite of the file. The source is read; the result is out.pst.
var rep = new AuthoringSession("data.pst")
    .RenameFolder("Old", "Old Mail")
    .SetFolderClass("Archive", FolderClass.Mail)
    .DeleteItems("Spam", m => m.Subject.Contains("[AD]"))
    .Commit("out.pst", overwrite: true);
Console.WriteLine(rep.ToString());                       // ErrorCode 0: every change applied

Make a folder a calendar, contacts or tasks folder

A folder's class decides how Outlook shows it. Use the FolderClass values: Mail (the default), Appointment, Contact, Task, StickyNote, Journal.

VB.NET

' A folder is a mail folder until its class says otherwise; the class is what makes Outlook
' show a calendar, a card view or a task list.
Dim rep = Author.SetFolderClass("data.pst", "out.pst", "Archive", FolderClass.Appointment, overwrite:=True)
Console.WriteLine($"{rep.FoldersReclassified} folder(s) changed")

Using store = PersonalStorage.Open("out.pst")
    For Each top In store.RootFolder.SubFolders()
        For Each f In top.SubFolders()
            Console.WriteLine($"{f.DisplayName}: {f.ContainerClass}")
        Next
    Next
End Using

C#

// A folder is a mail folder until its class says otherwise; the class is what makes Outlook
// show a calendar, a card view or a task list.
var rep = Author.SetFolderClass("data.pst", "out.pst", "Archive", FolderClass.Appointment, overwrite: true);
Console.WriteLine($"{rep.FoldersReclassified} folder(s) changed");

using (var store = PersonalStorage.Open("out.pst"))
    foreach (var top in store.RootFolder.SubFolders())
        foreach (var f in top.SubFolders())
            Console.WriteLine($"{f.DisplayName}: {f.ContainerClass}");

The class says what kind of folder it is, not which folder: subfolders of a calendar are usually calendars too, so two folders can share a class.

Save, copy, move, delete and import, as an application does

ItemOps takes the node ids your lists already hold and does the job for every kind of item: a contact saves as .vcf and copies as a contact. It also answers whether a store can be written to, in words you can show the user; a legacy ANSI store cannot.

VB.NET

Dim diag As New DiagnosticsContext()

' Ask the library, and show its words, before offering to change a file.
If Not ItemOps.IsWritable("mail.pst") Then
    Console.WriteLine(ItemOps.WhyNotWritable("mail.pst"))
    Return
End If

' The items to act on: here, everything in the Inbox, by node id.
Dim inbox As String, nids As New HashSet(Of UInteger)()
Using store = PersonalStorage.Open("mail.pst")
    Dim rows = store.Views.Mail(New ItemQuery().InFolders(Function(p) p.EndsWith("\Inbox"))).ToList()
    inbox = rows(0).FolderPath
    For Each row In rows : nids.Add(row.Nid) : Next
End Using

' Save as files: mail as .msg, contacts as .vcf, appointments as .ics, notes as .txt.
Dim saved = ItemOps.SaveItems("mail.pst", inbox, nids, "saved")
Console.WriteLine(If(saved.Ok, $"{saved.Saved} file(s) saved", saved.Error))

' Copy into another store. Every write makes a new file (the "out" path), checked before
' it is kept; your application swaps it in.
Dim copied = ItemOps.CopyItems("mail.pst", inbox, nids, "target.pst", "target-out.pst", "From mail.pst", diag)
Console.WriteLine(copied.ToString())

' Move and delete have the same shape.
Dim moved = ItemOps.MoveItems("mail.pst", "moved.pst", inbox, "Archive", nids, diag)
Dim deleted = ItemOps.DeleteItems("mail.pst", "deleted.pst", inbox, nids, diag)

' Files in: .msg, .eml, .ics, .vcf, .mbox.
Dim imported = ItemOps.ImportFiles("mail.pst", "imported.pst", "Inbox", {"message.msg", "event.ics"}, diag)
Console.WriteLine(imported.ToString())

C#

var diag = new DiagnosticsContext();

// Ask the library, and show its words, before offering to change a file.
if (!ItemOps.IsWritable("mail.pst"))
{
    Console.WriteLine(ItemOps.WhyNotWritable("mail.pst"));
    return;
}

// The items to act on: here, everything in the Inbox, by node id.
string inbox;
var nids = new HashSet<uint>();
using (var store = PersonalStorage.Open("mail.pst"))
{
    var rows = store.Views.Mail(new ItemQuery().InFolders(p => p.EndsWith(@"\Inbox"))).ToList();
    inbox = rows[0].FolderPath;
    foreach (var row in rows) nids.Add(row.Nid);
}

// Save as files: mail as .msg, contacts as .vcf, appointments as .ics, notes as .txt.
var saved = ItemOps.SaveItems("mail.pst", inbox, nids, "saved");
Console.WriteLine(saved.Ok ? $"{saved.Saved} file(s) saved" : saved.Error);

// Copy into another store. Every write makes a new file (the "out" path), checked before
// it is kept; your application swaps it in.
var copied = ItemOps.CopyItems("mail.pst", inbox, nids, "target.pst", "target-out.pst", "From mail.pst", diag);
Console.WriteLine(copied.ToString());

// Move and delete have the same shape.
var moved = ItemOps.MoveItems("mail.pst", "moved.pst", inbox, "Archive", nids, diag);
var deleted = ItemOps.DeleteItems("mail.pst", "deleted.pst", inbox, nids, diag);

// Files in: .msg, .eml, .ics, .vcf, .mbox.
var imported = ItemOps.ImportFiles("mail.pst", "imported.pst", "Inbox", new[] { "message.msg", "event.ics" }, diag);
Console.WriteLine(imported.ToString());

Bastion PST SDK 3.0.0 › Cookbooks

Errors, progress and logs

What a result tells you, how to follow a long operation, how to stop one, and what to do with a legacy ANSI store.

Error codes

Every operation returns a result derived from OperationResult. ErrorCode is Ok (0) on success. ErrorDescription is a sentence fit to show a user, ToString() gives "code: description", and Detail holds the technical text for your log. The full list is in ErrorCode.

VB.NET

' sources is the list of PST files to merge.
' Operations report; they do not throw. Check ErrorCode, and show ToString() to a user.
Dim rep = StoreMerger.Merge(sources, "merged.pst")
Select Case rep.ErrorCode
    Case ErrorCode.Ok
        Console.WriteLine("Done.")
    Case ErrorCode.FileNotFound
        Console.WriteLine("A source is missing.")
    Case ErrorCode.FileLocked
        Console.WriteLine("A file is open in another program, perhaps Outlook. Close it and try again.")
    Case ErrorCode.DestinationExists
        Console.WriteLine("merged.pst exists. Pass overwrite:=True to replace it.")
    Case ErrorCode.DiskFull, ErrorCode.InsufficientDiskSpace
        Console.WriteLine("Not enough disk space.")
    Case ErrorCode.OutputSizeExceeded, ErrorCode.NodeIdCapacityExceeded
        Console.WriteLine("Too much for one file: use StoreMerger.MergeToVolumes.")
    Case Else
        Console.WriteLine(rep.ToString())                    ' "code: description"
        Console.WriteLine(rep.Detail)                        ' more, for your log
End Select

C#

// sources is the list of PST files to merge.
// Operations report; they do not throw. Check ErrorCode, and show ToString() to a user.
var rep = StoreMerger.Merge(sources, "merged.pst");
switch (rep.ErrorCode)
{
    case ErrorCode.Ok:
        Console.WriteLine("Done.");
        break;
    case ErrorCode.FileNotFound:
        Console.WriteLine("A source is missing.");
        break;
    case ErrorCode.FileLocked:
        Console.WriteLine("A file is open in another program, perhaps Outlook. Close it and try again.");
        break;
    case ErrorCode.DestinationExists:
        Console.WriteLine("merged.pst exists. Pass overwrite: true to replace it.");
        break;
    case ErrorCode.DiskFull:
    case ErrorCode.InsufficientDiskSpace:
        Console.WriteLine("Not enough disk space.");
        break;
    case ErrorCode.OutputSizeExceeded:
    case ErrorCode.NodeIdCapacityExceeded:
        Console.WriteLine("Too much for one file: use StoreMerger.MergeToVolumes.");
        break;
    default:
        Console.WriteLine(rep.ToString());                    // "code: description"
        Console.WriteLine(rep.Detail);                        // more, for your log
        break;
}

Progress, recovery and the user log

A DiagnosticsContext passed to an operation reports progress, writes a plain-language log the user can read, looks for damage as each source is opened, and with RecoverFromCorruption skips a damaged item instead of stopping. The log holds no message content.

VB.NET

Dim diag As New DiagnosticsContext With {
    .CreateUserLog = True,           ' a plain-language log a user can read and send you
    .RecoverFromCorruption = True,   ' skip a damaged item and carry on, rather than stop
    .ScanSourcesOnOpen = True}       ' look for damage as each source is opened
AddHandler diag.WriteProgress, Sub(s, e)
                                   ' -1 while the total is not yet known
                                   If e.PercentComplete >= 0 Then Console.Write($"{vbCr}{e.PercentComplete:N0}%   ")
                               End Sub
AddHandler diag.ErrorOccurred, Sub(s, e) Console.WriteLine($"skipped: {e.Message}")

Dim rep = StoreMerger.Merge({"a.pst", "b.pst"}, "merged.pst", diag:=diag, overwrite:=True)
Console.WriteLine()
Console.WriteLine(rep.ToString())
Console.WriteLine("Log: " & diag.UserLogPath)

C#

var diag = new DiagnosticsContext
{
    CreateUserLog = true,           // a plain-language log a user can read and send you
    RecoverFromCorruption = true,   // skip a damaged item and carry on, rather than stop
    ScanSourcesOnOpen = true        // look for damage as each source is opened
};
diag.WriteProgress += (s, e) =>
{
    // -1 while the total is not yet known
    if (e.PercentComplete >= 0) Console.Write($"\r{e.PercentComplete:N0}%   ");
};
diag.ErrorOccurred += (s, e) => Console.WriteLine($"skipped: {e.Message}");

var rep = StoreMerger.Merge(new[] { "a.pst", "b.pst" }, "merged.pst", diag: diag, overwrite: true);
Console.WriteLine();
Console.WriteLine(rep.ToString());
Console.WriteLine("Log: " + diag.UserLogPath);

Cancel a long operation

VB.NET

' Writes are atomic: a cancelled operation leaves no output file and the source untouched.
Using cts As New CancellationTokenSource()
    Dim diag As New DiagnosticsContext With {.CancellationToken = cts.Token}
    cts.CancelAfter(TimeSpan.FromMinutes(5))             ' or cts.Cancel() from a Cancel button
    Dim rep = StoreMerger.Merge({"a.pst", "b.pst"}, "merged.pst", diag:=diag, overwrite:=True)
    If rep.ErrorCode = ErrorCode.OperationCancelled Then Console.WriteLine("Cancelled; nothing written.")
End Using

C#

// Writes are atomic: a cancelled operation leaves no output file and the source untouched.
using (var cts = new CancellationTokenSource())
{
    var diag = new DiagnosticsContext { CancellationToken = cts.Token };
    cts.CancelAfter(TimeSpan.FromMinutes(5));             // or cts.Cancel() from a Cancel button
    var rep = StoreMerger.Merge(new[] { "a.pst", "b.pst" }, "merged.pst", diag: diag, overwrite: true);
    if (rep.ErrorCode == ErrorCode.OperationCancelled) Console.WriteLine("Cancelled; nothing written.");
}

A result with losses

CompletedWithLosses means the operation finished, and some content could not be carried over. Losses lists each: what, where, and why.

VB.NET

' A result can be a success with losses: CompletedWithLosses says some content could not be
' carried over, and Losses says what, where and why.
Dim diag As New DiagnosticsContext With {.RecoverFromCorruption = True}
Dim rep = StoreMerger.Merge({"a.pst", "b.pst"}, "merged.pst", diag:=diag, overwrite:=True)
If rep.ErrorCode = ErrorCode.CompletedWithLosses Then
    For Each loss In rep.Losses
        Console.WriteLine(loss.ToString())
    Next
End If

C#

// A result can be a success with losses: CompletedWithLosses says some content could not be
// carried over, and Losses says what, where and why.
var diag = new DiagnosticsContext { RecoverFromCorruption = true };
var rep = StoreMerger.Merge(new[] { "a.pst", "b.pst" }, "merged.pst", diag: diag, overwrite: true);
if (rep.ErrorCode == ErrorCode.CompletedWithLosses)
    foreach (var loss in rep.Losses)
        Console.WriteLine(loss.ToString());

Legacy ANSI stores

The library writes Unicode only. Adding to or editing an ANSI store would convert it, and Outlook 2002 and earlier cannot open the result, so it is refused with AnsiUpgradeRequired unless you allow it: answer the AnsiUpgradeRequired event, or set DiagnosticsContext.AllowAnsiToUnicodeUpgrade.

Compiled, not run: the test needs an ANSI store, which this library cannot write.

VB.NET

' items: ImportedMessage items to add (see ItemBuilder). userSaidYes: your user's answer.
' The library writes Unicode only. Adding to a legacy ANSI store converts it, and Outlook 2002
' and earlier cannot open the result, so that conversion needs your explicit yes.
Dim diag As New DiagnosticsContext()
AddHandler diag.AnsiUpgradeRequired, Sub(s, e) e.Proceed = userSaidYes
Dim rep = Author.AddItems("legacy.pst", "out.pst", items, "Inbox", diag)
If rep.ErrorCode = ErrorCode.AnsiUpgradeRequired Then
    Console.WriteLine("Not converted; legacy.pst is unchanged.")
End If

C#

// items: ImportedMessage items to add (see ItemBuilder). userSaidYes: your user's answer.
// The library writes Unicode only. Adding to a legacy ANSI store converts it, and Outlook 2002
// and earlier cannot open the result, so that conversion needs your explicit yes.
var diag = new DiagnosticsContext();
diag.AnsiUpgradeRequired += (s, e) => e.Proceed = userSaidYes;
var rep = Author.AddItems("legacy.pst", "out.pst", items, "Inbox", diag);
if (rep.ErrorCode == ErrorCode.AnsiUpgradeRequired)
    Console.WriteLine("Not converted; legacy.pst is unchanged.");

Bastion PST SDK 3.0.0 › Cookbooks

Licensing and deployment

How the library decides whether it may run, and what to put in the application you ship.

How it decides

The first time your program uses the library, it checks, in this order:

  1. A runtime key set in code. If there is one, it is checked offline and decides alone. An invalid, revoked or out-of-maintenance key is refused; it never falls back to a developer's licence.
  2. A developer licence on this computer, activated in Bastion Licence Manager.
  3. A trial on this computer. The first run under the Visual Studio debugger (F5) on a computer with neither starts a 30-day trial; it needs an internet connection that once. The trial is once per computer and cannot be extended.

Licences and trials are kept per Windows account. Debug or Release makes no difference: a Release build run on your own computer, under the debugger or not, runs on your licence or trial. On any other computer or account, without a runtime key, it is refused.

Set the runtime key in the application you ship

Get the key in Bastion Licence Manager (Runtime key…) and set it once, before the first use of the library. It is checked offline: your customers need no activation and no internet connection, and your application never contacts us.

VB.NET

' In the application you ship: once, before the first use of the library -
' at the top of Sub Main, or in the Startup event of a Windows Forms application.
Sub ApplicationStartup()
    Bastion.Pst.Licence.SetRuntimeKey("<your runtime key>")

    ' ... the rest of your application ...
End Sub

C#

// In the application you ship: once, before the first use of the library -
// at the top of Main, or in your App startup.
static void ApplicationStartup()
{
    Bastion.Pst.Licence.SetRuntimeKey("<your runtime key>");

    // ... the rest of your application ...
}

Compiled, not run: a placeholder key is refused, by design.

Keep the key out of public source control. It identifies your licence.

When the library refuses to run

Without a runtime key, a licence or a trial, the first use of the library throws InvalidOperationException. It is the one exception the library throws on purpose, and it is thrown even by the operations that otherwise report failures in their result. Its message says what to do, for example:

  • “This application uses Bastion Pst Sdk without a runtime key. Contact the application's vendor. If you are developing with it, run your project once under the Visual Studio debugger to start a 30-day trial, or activate it in Bastion Licence Manager.”
  • “The 30-day trial of Bastion Pst Sdk on this computer has ended. Buy a licence: https://bastionsoftwaresolutions.com/products/”

VB.NET

' Without a licence, a trial or a runtime key, the first use of the library throws
' InvalidOperationException. Its message says what to do; show it, or log it.
Try
    Using store = PersonalStorage.Open("mail.pst")
        Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders")
    End Using
Catch ex As InvalidOperationException
    Console.WriteLine(ex.Message)
    Console.WriteLine(ex.HelpLink)                     ' a web page about it, when there is one
    Environment.ExitCode = 2
End Try

C#

// Without a licence, a trial or a runtime key, the first use of the library throws
// InvalidOperationException. Its message says what to do; show it, or log it.
try
{
    using (var store = PersonalStorage.Open("mail.pst"))
        Console.WriteLine($"{store.RootFolder.SubFolders().Count()} top-level folders");
}
catch (InvalidOperationException ex)
{
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.HelpLink);                     // a web page about it, when there is one
    Environment.ExitCode = 2;
}

The trial's limit

During the trial a merge takes at most two PST or OST files at a time. Nothing else is limited. A merge of more throws InvalidOperationException whose Data("BastionTrialLimit") is "SourceCount"; a licence removes the limit.

VB.NET

' sources is the list of PST or OST files to merge.
' The trial's one limit: a merge takes at most two PST or OST files. Everything else works.
Try
    Dim rep = StoreMerger.Merge(sources, "merged.pst", overwrite:=True)
    Console.WriteLine(rep.ToString())
Catch ex As InvalidOperationException When TryCast(ex.Data("BastionTrialLimit"), String) = "SourceCount"
    Console.WriteLine(ex.Message)                      ' "...at most 2 PST or OST files..."
End Try

C#

// sources is the list of PST or OST files to merge.
// The trial's one limit: a merge takes at most two PST or OST files. Everything else works.
try
{
    var rep = StoreMerger.Merge(sources, "merged.pst", overwrite: true);
    Console.WriteLine(rep.ToString());
}
catch (InvalidOperationException ex) when (ex.Data["BastionTrialLimit"] as string == "SourceCount")
{
    Console.WriteLine(ex.Message);                      // "...at most 2 PST or OST files..."
}

Services, tests and build servers

A Windows service, an IIS application, a test run or a build server runs under another account, which does not see your licence. Set the runtime key there too, or the first use of the library is refused.

What you may redistribute

Bastion.Pst.dll for your application's framework, and the Microsoft DLLs beside it in that Bin folder. Not the XML documentation, the samples, the help or Bastion Licence Manager. The installer's REDIST.txt and the Software Licence Agreement have the details.

Bastion PST SDK 3.0.0 › Cookbooks

PowerShell

The library is an ordinary .NET assembly, so a PowerShell script can load it with Add-Type: no COM, no Outlook, no MAPI.

This script was run in Windows PowerShell 5.1 against the library, with the result shown under it. It reads a store, merges two, and checks every store in a folder.

# Windows PowerShell 5.1 runs on .NET Framework; PowerShell 7 on .NET.
$framework = if ($PSVersionTable.PSEdition -eq 'Core') { 'net8.0' } else { 'net48' }
Add-Type -Path (Join-Path $env:BASTION_PSTSDK_DIR "Bin\$framework\Bastion.Pst.dll")

# .NET resolves relative paths against the process directory, not PowerShell's location.
[Environment]::CurrentDirectory = (Get-Location).Path

# A shipped script sets the runtime key, like any application.
# [Bastion.Pst.Licence]::SetRuntimeKey('<your runtime key>')

# What is in a store: folders and counts.
$store = [Bastion.Pst.Messaging.PersonalStorage]::Open('mail.pst')
try {
    $store.Views.Mail($null) |
        Group-Object FolderPath |
        Select-Object @{ n = 'Folder'; e = { $_.Name } }, Count |
        Format-Table -AutoSize
} finally {
    $store.Dispose()
}

# Merge two stores. Optional arguments can be left off the end, but not named:
# to set layout, pass everything before it ($null for a default).
$merge = [Bastion.Pst.Convert.StoreMerger]::Merge(
    [string[]]@('a.pst', 'b.pst'), 'merged.pst',
    (New-Object Bastion.Pst.Convert.Dedup),            # dedup
    $null,                                             # keepKinds
    $null,                                             # diag
    $true,                                             # overwrite
    $null,                                             # extraDrops
    0,                                                 # maxBytes
    [Bastion.Pst.Convert.MergeLayout]::Unified)        # layout
if ($merge.ErrorCode -ne [Bastion.Pst.ErrorCode]::Ok) { Write-Warning $merge.ErrorDescription }
else { '{0:N0} items merged, {1:N0} duplicates removed' -f $merge.MessagesMerged, $merge.DuplicatesRemoved }

# Check every store in a folder.
Get-ChildItem *.pst | ForEach-Object {
    $health = [Bastion.Pst.Validation.PstHealth]::Check($_.FullName)
    [pscustomobject]@{ File = $_.Name; Damaged = $health.IsCorrupted; Result = $health.ToString() }
} | Format-Table -AutoSize
Folder                                  Count
------                                  -----
Top of Outlook data file\Spam               1
Top of Outlook data file\Sent Items         1
Top of Outlook data file\Inbox              2
Top of Outlook data file\Inbox\Projects     1

3 items merged, 1 duplicates removed

File        Damaged Result
----        ------- ------
a.pst         False 0: OK
b.pst         False 0: OK
damaged.pst    True 0: OK
mail.pst      False 0: OK
merged.pst    False 0: OK

Three things to know

  • Load the build for your PowerShell. Windows PowerShell 5.1 needs a .NET Framework build such as net48; PowerShell 7 needs a .NET build such as net8.0. The wrong one fails to load with an error that looks like a damaged file.
  • Optional arguments. PowerShell lets you leave optional arguments off the end of a call, but not name them, so to set a later one pass every argument before it, with $null or the default for those you do not want to change. The parameter lists are in the API reference.
  • Filter with a query, not Where-Object. Where-Object runs after each item has been read. Pass an ItemQuery to Views.Mail and rows are rejected before any item is opened (Filter before an item is opened).

Bastion PST SDK 3.0.0

Sample projects

Two complete programs, each in VB.NET and C#, ready to open in Visual Studio and run.

The installer puts them in C:\Users\Public\Documents\Bastion Software Solutions\Bastion PST SDK\Samples\, one folder per language. The Start menu's Samples shortcut opens that folder.

SampleWhat it does
ReadInboxOpens a PST or OST and lists its top-level folders with the number of items in each: the result-object pattern and the read model.
MergeTwoPstFilesMerges two PST files into a new one: options, progress, the result, and where the runtime key goes before you ship.

Opening a sample

Each sample has a solution for each Visual Studio version:

SolutionVisual StudioBuilds for
<Sample>.VS2019.sln2017 and 2019.NET Framework 4.8
<Sample>.VS2022.sln2022.NET Framework 4.8 and .NET 8
<Sample>.VS2026.sln2026.NET Framework 4.8 and .NET 10

The projects reference the library through the BASTION_PSTSDK_DIR environment variable the installer set, choosing the build for the framework being compiled. If Visual Studio was open when you installed, close it and open it again once. Then press F5: the first run under the debugger starts the trial if this computer has no licence.

Running a sample's Release build

On your own computer a sample runs on your licence or trial, with or without the debugger. On another computer, or under another Windows account, it is refused until you set a runtime key; the samples show where. The installer's Trial and Release Builds read-me goes through each case.

Bastion PST SDK 3.0.0

Questions and answers

Which build do I reference?

The one for your project's framework. Through NuGet this happens by itself. From the installer, point the reference at Bin\<framework>\Bastion.Pst.dll; in an SDK-style project $(BASTION_PSTSDK_DIR)Bin\$(TargetFramework)\Bastion.Pst.dll picks it for every framework the project builds for (Getting started). A .NET Core 2.1 project uses netcoreapp2.0. A Windows Forms or WPF project on net8.0-windows can use net8.0-windows or net8.0: the API is the same.

How do I tell whether an operation succeeded?

Check the result's ErrorCode: Ok (0) is success. ErrorDescription is a sentence for the user, ToString() gives "code: description", and Detail has the technical text for a support ticket. CompletedWithLosses means the operation finished but some content could not be carried over; the result's Losses say what. Operations do not throw; the one exception is licensing (When the library refuses to run). The codes are listed in ErrorCode.

FileLocked (3), but nothing else has the file open

Outlook has it: a store in an Outlook profile stays open while Outlook runs. Close Outlook, or remove the data file from the profile, and try again.

Some folders or messages are missing after a merge

By default a merge leaves out messages with no subject, no body and no attachment, which open to nothing. With pruneEmpty it also leaves out folders that end up empty. Each removal is listed in the user log when CreateUserLog is set. To keep everything, pass dropBlankMessages:=False and leave pruneEmpty off. Search folders are never copied: their mail is in the folders they search.

A folder shows a count in Outlook but opens empty

Usually Outlook's view, not missing mail: a filter on the view hides it. In Outlook, use View › Change View › Reset View. To check the data, PstHealth.Check compares each folder's recorded count with the items it holds.

Will the files it writes open in my Outlook?

In Outlook 2003 and every later version, yes. Not in Outlook 2002 or earlier, which read only the legacy ANSI format; the library writes Unicode only. It reads ANSI files, and converts them when you ask. Adding to an ANSI store is refused unless you allow the conversion (Legacy ANSI stores).

Can I set the name Outlook shows for a merged store?

Yes, with rootName: any printable Unicode, up to 200 UTF-16 code units (an emoji counts as two). Control characters are removed and spaces trimmed. Without it, a merge is named “Stacked Merge” or “Unified Merge”.

Text from an old ANSI store looks wrong on .NET Core or .NET 5+

The library registers the code pages it needs itself. Where a framework needs a newer System.Text.Encoding.CodePages.dll than it has built in (.NET Core 2.0 and 3.1, .NET 5 to 7), that DLL is beside the library in the framework's Bin folder, and the NuGet package brings it in. If names and subjects come back empty, check that the DLL was deployed with your application.

Listing a big folder is slow

Filtering with LINQ opens every item before testing it. Use an ItemQuery, which tests the folder's contents table first and opens only what passes (Filter before an item is opened), and show progress from PstEvents.Default.PstRead, which has a real total from the start.

Do the logs or support reports hold private data?

No. The user log and support reports describe the file's structure and what the library did. They hold no message content, subjects, addresses or attachments, so a user can send them to you, or to support@bastionsoftwaresolutions.email.

In VB.NET, Convert.ToInt32 stops compiling

With Imports Bastion.Pst, the name Convert also means the namespace Bastion.Pst.Convert. Write System.Convert.ToInt32, or import Bastion.Pst.Convert directly instead of relying on Imports Bastion.Pst.

Bastion PST SDK 3.0.0

API reference

Every public type in Bastion.Pst.dll, by namespace. Each type's page shows its declaration in VB.NET and C#, and every constructor, property, method, event and field with its parameters, return value and remarks.

NamespaceTypesContents
Bastion.Pst14ErrorCode, FileOpResult, GenericResult, Licence, LossKind, LossRecord, …
Bastion.Pst.Authoring12AppointmentBuilder, Author, AuthoringSession, ContactBuilder, DistListBuilder, ItemBuilder, …
Bastion.Pst.Convert23Dedup, DestinationExistsException, EditReport, ItemEdit, MergeLayout, MergePreflight, …
Bastion.Pst.Diagnostics11ActivityEventArgs, AnsiUpgradeEventArgs, CorruptionEventArgs, DiagEventArgs, DiagnosticsContext, DiagPhase, …
Bastion.Pst.Export7ExportFormat, ExportReport, ItemExporter, MessageExporter, StoreBuilder, StoreExporter, …
Bastion.Pst.Import28EmlReader, IcsReader, ImportedAddress, ImportedAppointment, ImportedAttachment, ImportedContact, …
Bastion.Pst.Messaging37AppointmentItem, AppointmentRecurrence, Attachment, AttachMethod, BusyStatus, ContactItem, …
Bastion.Pst.Ndb1PstFormat
Bastion.Pst.Repair2PstRepair, RepairReport
Bastion.Pst.Validation6HealthResult, PstHealth, PstValidator, ValidationIssue, ValidationReport, ValidationSeverity
Bastion.Pst.Views20AppointmentView, AttachmentBytesResult, AttachmentView, ContactMerger, ContactView, ItemDetail, …

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
FileOpResultResult of a file-producing call (e.g. SaveSupportReport): the path plus the error contract.
GenericResultResult for operations with no extra payload (e.g. ConvertToUnicode).
LicenceLicensing of Bastion Pst Sdk inside an application you distribute.
LossRecordOne thing an operation could not read or carry into its output.
OperationResultBase of every operation result: error code + descriptions + ToString "code: description".
PstCloseEventArgs
PstErrorEventArgs
PstEventsSubscribe to Default to observe PST activity across the whole library.
PstFolderSelectedEventArgs
PstOpenEventArgs
PstReadEventArgs
SettingsLibrary-wide settings. Each applies to every operation started after it is changed.

Enumerations

NameDescription
ErrorCodeFailure classes returned by every Bastion PST SDK operation. 0 = success.
LossKindWhat kind of thing an operation could not read or carry into its output.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

ErrorCode enumeration

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Failure classes returned by every Bastion PST SDK operation. 0 = success.

VB.NET

Public Enum ErrorCode

C#

public enum ErrorCode

Members

NameValueDescription
Ok0Success.
UnknownError1Unclassified failure — see ErrorDescription/Detail.
FileNotFound2A source or destination path does not exist.
FileLocked3A file is locked by another process (commonly: the PST is mounted in Outlook).
DiskFull4The destination disk is full (or ran out of space mid-write).
AccessDenied5Access denied (permissions/read-only).
InvalidPstFormat6The file is not a readable PST/OST (bad header/structure beyond recovery).
DestinationExists7The destination already exists and overwrite was not requested.
OutputSizeExceeded8The output would exceed the requested size cap.
InvalidArgument9An argument was invalid (bad path, empty source list, …).
InvalidRootName10The requested store root name is invalid (empty after sanitising / too long).
NodeIdCapacityExceeded11The merge exceeds a single PST's node-id capacity — split into volumes instead.
InsufficientDiskSpace12Disk free space is too low to start the operation safely.
AnsiUpgradeRequired13The operation would rewrite a legacy ANSI PST as a Unicode PST (which Outlook 2002 and earlier cannot open), and that upgrade was not explicitly authorised. Nothing was written — the source PST is untouched. Authorise via DiagnosticsContext.AllowAnsiToUnicodeUpgrade or the AnsiUpgradeRequired event, or convert the store to Unicode explicitly first.
OperationCancelled14The caller cancelled the operation via DiagnosticsContext.CancellationToken. The atomic-write model means nothing partial was left behind — the destination is untouched.
CompletedWithLosses15The operation finished and wrote its output, but some content could not be read or carried and is missing from it or incomplete in it. OperationResult.Losses lists what, and OperationResult.LossCount counts it. Returned only when DiagnosticsContext.RecoverFromCorruption is set, or by a repair; otherwise content that cannot be read fails the operation with InvalidPstFormat and nothing is written.
OutputInvalid16The operation wrote a file, but the file failed the structural check that follows, or could not be reopened. Do not use it.
OutOfMemory17The process ran out of memory. Closing other programs, or running the operation as a 64-bit process, may let it finish.
VerificationFailed18The output was written, but it does not hold what the sources held: the check asked for with verify found folders or messages missing, extra or miscounted. OperationResult.Losses lists each difference.
InvalidInputFile19A file given to an import (an .eml, .msg, .ics, .vcf, .mbox, .olm or TNEF file) is not a readable file of that kind. Distinct from InvalidPstFormat, which is about a PST or OST.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

FileOpResult class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Result of a file-producing call (e.g. SaveSupportReport): the path plus the error contract.

VB.NET

Public NotInheritable Class FileOpResult
    Inherits OperationResult

C#

public sealed class FileOpResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
FileOpResult()

Properties

NameDescription
PathFull path of the file written (Nothing on failure).

Details

FileOpResult() constructor

VB.NET

Public Sub New()

C#

public FileOpResult();

Path property

Full path of the file written (Nothing on failure).

VB.NET

Public Property Path As String

C#

public string Path { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

GenericResult class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Result for operations with no extra payload (e.g. ConvertToUnicode).

VB.NET

Public NotInheritable Class GenericResult
    Inherits OperationResult

C#

public sealed class GenericResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
GenericResult()

Details

GenericResult() constructor

VB.NET

Public Sub New()

C#

public GenericResult();

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

Licence class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Licensing of Bastion Pst Sdk inside an application you distribute.

VB.NET

Public NotInheritable Class Licence

C#

public sealed class Licence

Methods

NameDescription
SetRuntimeKey(String) staticSets the runtime key for this library, from Bastion Licence Manager (Runtime key…). Call it once, before the application first uses the library. The key is checked offline when the library is first used: it never makes a network connection. Passing Nothing clears it; the library then needs a developer activation on the computer.

Details

SetRuntimeKey(String) method static

Sets the runtime key for this library, from Bastion Licence Manager (Runtime key…). Call it once, before the application first uses the library. The key is checked offline when the library is first used: it never makes a network connection. Passing Nothing clears it; the library then needs a developer activation on the computer.

VB.NET

Public Shared Sub SetRuntimeKey(runtimeKey As String)

C#

public static void SetRuntimeKey(string runtimeKey);

Parameters

runtimeKey String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

LossKind enumeration

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

What kind of thing an operation could not read or carry into its output.

VB.NET

Public Enum LossKind

C#

public enum LossKind

Members

NameValueDescription
Other0Something that fits no other kind; see the record's Location and Reason.
Source1A whole source file was left out.
Folder2A folder, or everything beneath it.
Table3A folder's table of contents, of subfolders or of associated items. The items it listed may be missing from the output or present but not listed.
Message4A message or other item (contact, appointment, task, note).
Attachment5An attachment, or an item's recipient list.
Property6One property of an item, such as its body.
Node7A low-level node or data block that could not be attributed to an item.
Checksum8Data was read but failed its checksum, so its content may be wrong.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

LossRecord class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

One thing an operation could not read or carry into its output.

VB.NET

Public NotInheritable Class LossRecord

C#

public sealed class LossRecord

Properties

NameDescription
ExceptionTypeThe type name of the exception behind it, for support; empty when there was none.
KindWhat kind of thing was lost.
LocationWhere in that file: a folder path, or a node id such as "node 0x00200024". Never message content.
ReasonWhy it could not be read, in one line.
SourceThe source file it belonged to, when known; otherwise empty.

Methods

NameDescription
ToString()"Message, node 0x00200024 in archive.pst: the data block is missing".

Details

ExceptionType property

The type name of the exception behind it, for support; empty when there was none.

VB.NET

Public ReadOnly Property ExceptionType As String

C#

public string ExceptionType { get; }

Property value

String

Kind property

What kind of thing was lost.

VB.NET

Public ReadOnly Property Kind As LossKind

C#

public LossKind Kind { get; }

Property value

LossKind

Location property

Where in that file: a folder path, or a node id such as "node 0x00200024". Never message content.

VB.NET

Public ReadOnly Property Location As String

C#

public string Location { get; }

Property value

String

Reason property

Why it could not be read, in one line.

VB.NET

Public ReadOnly Property Reason As String

C#

public string Reason { get; }

Property value

String

Source property

The source file it belonged to, when known; otherwise empty.

VB.NET

Public ReadOnly Property Source As String

C#

public string Source { get; }

Property value

String

ToString() method

"Message, node 0x00200024 in archive.pst: the data block is missing".

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

OperationResult class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Base of every operation result: error code + descriptions + ToString "code: description".

VB.NET

Public MustInherit Class OperationResult

C#

public abstract class OperationResult

Derived: FileOpResult, GenericResult, EditReport, MergeReport, OrphanScanResult, PasswordChangeReport, PasswordStatus, PreflightReport, SplitReport, SweepPlanResult, VolumeReport, ExportReport, TextResult, ImportManyResult, ImportReport, ImportResult, TnefResult, OpenResult, RepairReport, HealthResult, AttachmentBytesResult, SaveReport

Properties

NameDescription
DetailFull technical detail (exception text incl. stack trace) — for logs/support, may be empty.
ErrorCode0 (Ok) = success; otherwise the failure class.
ErrorDescriptionOne-line, human-readable reason. "OK" on success.
LossCountHow many things could not be read or carried. Zero when nothing was lost.
LossesWhat the operation could not read or carry into its output: one record per source file, folder, message or attachment, each saying where it was and why. Holds at most the first 1,000; LossCount is the true total. Empty when nothing was lost.
OutputWrittenTrue when the operation wrote its output: it succeeded, or it finished with ErrorCode.CompletedWithLosses or ErrorCode.VerificationFailed. Every other code means nothing was written, or what was written must not be used.
SucceededTrue when ErrorCode = Ok.
WarningsThings the caller should know that lost no data, in plain language.

Methods

NameDescription
ToString()"0: OK" or e.g. "3: The file 'x.pst' is locked by another process …".

Details

Detail property

Full technical detail (exception text incl. stack trace) — for logs/support, may be empty.

VB.NET

Public Property Detail As String

C#

public string Detail { get; set; }

Property value

String

ErrorCode property

0 (Ok) = success; otherwise the failure class.

VB.NET

Public Property ErrorCode As ErrorCode

C#

public ErrorCode ErrorCode { get; set; }

Property value

ErrorCode

ErrorDescription property

One-line, human-readable reason. "OK" on success.

VB.NET

Public Property ErrorDescription As String

C#

public string ErrorDescription { get; set; }

Property value

String

LossCount property

How many things could not be read or carried. Zero when nothing was lost.

VB.NET

Public Property LossCount As Integer

C#

public int LossCount { get; set; }

Property value

Int32

Losses property

What the operation could not read or carry into its output: one record per source file, folder, message or attachment, each saying where it was and why. Holds at most the first 1,000; LossCount is the true total. Empty when nothing was lost.

VB.NET

Public ReadOnly Property Losses As IReadOnlyList(Of LossRecord)

C#

public IReadOnlyList<LossRecord> Losses { get; }

Property value

IReadOnlyList<LossRecord>

OutputWritten property

True when the operation wrote its output: it succeeded, or it finished with ErrorCode.CompletedWithLosses or ErrorCode.VerificationFailed. Every other code means nothing was written, or what was written must not be used.

VB.NET

Public ReadOnly Property OutputWritten As Boolean

C#

public bool OutputWritten { get; }

Property value

Boolean

Succeeded property

True when ErrorCode = Ok.

VB.NET

Public Overridable ReadOnly Property Succeeded As Boolean

C#

public virtual bool Succeeded { get; }

Property value

Boolean

Warnings property

Things the caller should know that lost no data, in plain language.

VB.NET

Public ReadOnly Property Warnings As IReadOnlyList(Of String)

C#

public IReadOnlyList<string> Warnings { get; }

Property value

IReadOnlyList<String>

ToString() method

"0: OK" or e.g. "3: The file 'x.pst' is locked by another process …".

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

PstCloseEventArgs class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class PstCloseEventArgs
    Inherits EventArgs

C#

public sealed class PstCloseEventArgs : EventArgs

Inherits: EventArgs

Constructors

NameDescription
PstCloseEventArgs(String)

Properties

NameDescription
Path

Details

PstCloseEventArgs(String) constructor

VB.NET

Public Sub New(path As String)

C#

public PstCloseEventArgs(string path);

Parameters

path String

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

PstErrorEventArgs class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class PstErrorEventArgs
    Inherits EventArgs

C#

public sealed class PstErrorEventArgs : EventArgs

Inherits: EventArgs

Constructors

NameDescription
PstErrorEventArgs(ErrorCode, String, String)

Properties

NameDescription
ErrorCode
Message
Path

Details

PstErrorEventArgs(ErrorCode, String, String) constructor

VB.NET

Public Sub New(code As ErrorCode, message As String, path As String)

C#

public PstErrorEventArgs(ErrorCode code, string message, string path);

Parameters

code ErrorCode
message String
path String

ErrorCode property

VB.NET

Public ReadOnly Property ErrorCode As ErrorCode

C#

public ErrorCode ErrorCode { get; }

Property value

ErrorCode

Message property

VB.NET

Public ReadOnly Property Message As String

C#

public string Message { get; }

Property value

String

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

PstEvents class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Subscribe to Default to observe PST activity across the whole library.

VB.NET

Public NotInheritable Class PstEvents

C#

public sealed class PstEvents

Constructors

NameDescription
PstEvents()

Properties

NameDescription
Default staticThe single, process-wide event source. Accessible from any app.

Events

NameDescription
PstCloseA store was closed (disposed).
PstErrorSomething went wrong — carries an error code and message.
PstFolderSelectedA folder's items were read — carries the item count.
PstOpenA PST/OST store was opened.
PstReadProgress of a folder read — Current / Total items, and Percent.

Details

PstEvents() constructor

VB.NET

Public Sub New()

C#

public PstEvents();

Default property static

The single, process-wide event source. Accessible from any app.

VB.NET

Public Shared ReadOnly Property Default As PstEvents

C#

public static PstEvents Default { get; }

Property value

PstEvents

PstClose event

A store was closed (disposed).

VB.NET

Public Event PstClose As EventHandler(Of PstCloseEventArgs)

C#

public event EventHandler<PstCloseEventArgs> PstClose;

Event type

EventHandler<PstCloseEventArgs>

PstError event

Something went wrong — carries an error code and message.

VB.NET

Public Event PstError As EventHandler(Of PstErrorEventArgs)

C#

public event EventHandler<PstErrorEventArgs> PstError;

Event type

EventHandler<PstErrorEventArgs>

PstFolderSelected event

A folder's items were read — carries the item count.

VB.NET

Public Event PstFolderSelected As EventHandler(Of PstFolderSelectedEventArgs)

C#

public event EventHandler<PstFolderSelectedEventArgs> PstFolderSelected;

Event type

EventHandler<PstFolderSelectedEventArgs>

PstOpen event

A PST/OST store was opened.

VB.NET

Public Event PstOpen As EventHandler(Of PstOpenEventArgs)

C#

public event EventHandler<PstOpenEventArgs> PstOpen;

Event type

EventHandler<PstOpenEventArgs>

PstRead event

Progress of a folder read — Current / Total items, and Percent.

VB.NET

Public Event PstRead As EventHandler(Of PstReadEventArgs)

C#

public event EventHandler<PstReadEventArgs> PstRead;

Event type

EventHandler<PstReadEventArgs>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

PstFolderSelectedEventArgs class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class PstFolderSelectedEventArgs
    Inherits EventArgs

C#

public sealed class PstFolderSelectedEventArgs : EventArgs

Inherits: EventArgs

Constructors

NameDescription
PstFolderSelectedEventArgs(String, String, Int64)

Properties

NameDescription
Folder
ItemCount
Path

Details

PstFolderSelectedEventArgs(String, String, Int64) constructor

VB.NET

Public Sub New(path As String, folder As String, itemCount As Long)

C#

public PstFolderSelectedEventArgs(string path, string folder, long itemCount);

Parameters

path String
folder String
itemCount Int64

Folder property

VB.NET

Public ReadOnly Property Folder As String

C#

public string Folder { get; }

Property value

String

ItemCount property

VB.NET

Public ReadOnly Property ItemCount As Long

C#

public long ItemCount { get; }

Property value

Int64

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

PstOpenEventArgs class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class PstOpenEventArgs
    Inherits EventArgs

C#

public sealed class PstOpenEventArgs : EventArgs

Inherits: EventArgs

Constructors

NameDescription
PstOpenEventArgs(String)

Properties

NameDescription
Path

Details

PstOpenEventArgs(String) constructor

VB.NET

Public Sub New(path As String)

C#

public PstOpenEventArgs(string path);

Parameters

path String

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

PstReadEventArgs class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class PstReadEventArgs
    Inherits EventArgs

C#

public sealed class PstReadEventArgs : EventArgs

Inherits: EventArgs

Constructors

NameDescription
PstReadEventArgs(String, String, Int64, Int64)

Properties

NameDescription
Current
Folder
Path
PercentPercent read, 0..100; 0 while the total is not yet known.
Total

Details

PstReadEventArgs(String, String, Int64, Int64) constructor

VB.NET

Public Sub New(path As String, folder As String, current As Long, total As Long)

C#

public PstReadEventArgs(string path, string folder, long current, long total);

Parameters

path String
folder String
current Int64
total Int64

Current property

VB.NET

Public ReadOnly Property Current As Long

C#

public long Current { get; }

Property value

Int64

Folder property

VB.NET

Public ReadOnly Property Folder As String

C#

public string Folder { get; }

Property value

String

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Percent property

Percent read, 0..100; 0 while the total is not yet known.

VB.NET

Public ReadOnly Property Percent As Integer

C#

public int Percent { get; }

Property value

Int32

Total property

VB.NET

Public ReadOnly Property Total As Long

C#

public long Total { get; }

Property value

Int64

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace

Settings class

Namespace: Bastion.Pst · Assembly: Bastion.Pst.dll

Library-wide settings. Each applies to every operation started after it is changed.

VB.NET

Public NotInheritable Class Settings

C#

public sealed class Settings

Properties

NameDescription
TempFolder staticThe folder where the library writes its temporary files: a file being written before it is moved to its destination, the intermediate stores of a merge, split or repair, and the library's own logs. Reading it gives the folder in use: the one set here, or the current user's temporary folder (%TEMP%) when none is set. Setting Nothing or an empty string goes back to %TEMP%. A relative path is made full against the current directory when it is set. The folder is created when it is first needed.

Details

TempFolder property static

The folder where the library writes its temporary files: a file being written before it is moved to its destination, the intermediate stores of a merge, split or repair, and the library's own logs. Reading it gives the folder in use: the one set here, or the current user's temporary folder (%TEMP%) when none is set. Setting Nothing or an empty string goes back to %TEMP%. A relative path is made full against the current directory when it is set. The folder is created when it is first needed.

VB.NET

Public Shared Property TempFolder As String

C#

public static string TempFolder { get; set; }

Property value

String

Exceptions

ExceptionCondition
ArgumentExceptionThe value is not a valid path.

Remarks

The temporary folder needs free space for the whole of the largest file an operation writes: a merged PST is written there in full before it is moved to its destination. When the temporary folder is on a different drive from the destination, the finished file is copied to the destination's folder and then swapped into place, so the destination's drive needs that space too, and the copy takes time. Put the temporary folder on the same drive as the output to avoid both.

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Authoring namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
AppointmentBuilder
AuthorCreates and populates PST stores without Outlook: build typed items with the ItemBuilder factories, then add them to a new or existing store. Every write is an atomic rewrite validated by reopening — the store is never mutated in place.
AuthoringSessionAccumulates rename / move / delete / remove-attachment edits and applies them in a single atomic, reopen-validated rewrite. Fluent: chain the queue methods, then Commit.
ContactBuilder
DistListBuilder
ItemBuilderEntry point for building typed items: ItemBuilder.Mail(), .Appointment(), .Contact(), .Task(), .Note().
ItemBuilderBaseShared surface: subject/body/attachments and the terminal Build.
JournalBuilder
MailBuilder
NoteBuilder
RssBuilderAn RSS feed item (IPM.Post.Rss).
TaskBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

AppointmentBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class AppointmentBuilder
    Inherits ItemBuilderBase

C#

public sealed class AppointmentBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
AllDay(Boolean)
Attendee(String, String)Add a required attendee. The attendee list is written both as recipients and as the [MS-OXOCAL] attendee-string properties, so it reads back through AppointmentView.Attendees.
BodyText(String)
BusyStatus(Int32)0 free, 1 tentative, 2 busy, 3 out of office.
EndsAt(DateTime)When the appointment ends. Read as StartsAt reads its Date.
ExcludeOccurrences(DateTime[])Delete specific occurrence dates from the series (e.g. skip a holiday). Call after a Recur… method; the day is what matters.
InTimeZone(String)Say which time zone the appointment is in: the zone a Date of no kind given to StartsAt and EndsAt is a clock reading in, and the zone a recurring series recurs in ("every Monday at 09:00 in New York", whatever the season and wherever this code runs). May be called before or after the other methods.
Location(String)
ModifyOccurrence(DateTime, Nullable<DateTime>, Nullable<DateTime>, String, String, Nullable<Int32>)Override ONE occurrence of the series — move it and/or change its subject, location or busy status for that instance only ([MS-OXOCAL] exception). Call after a Recur… method. originalDate must be a date the pattern generates (and not an excluded one); a moved occurrence must stay on a day no other occurrence lands on. originalDate is a day on the series' own calendar (the zone it recurs in: see StartsAt). newStart and newEnd are read as StartsAt reads its Date: a Utc or Local Date is an instant, and one of no kind is a clock reading in the series' zone.
OptionalAttendee(String, String)Add an OPTIONAL attendee (the meeting's Cc line).
Organiser(String, String)The meeting organiser (defaults to the store owner when unset).
RecurDaily(Int32, Int32, Nullable<DateTime>)Make this a daily series: every interval days, ending after occurrences (0 = use until, or never if both unset).
RecurMonthly(Int32, Int32, Int32, Nullable<DateTime>)Make this a monthly series on day dayOfMonth (1–31; 31 = last), every interval months.
RecurWeekly(RecurDays, Int32, Int32, Nullable<DateTime>)Make this a weekly series on days, every interval weeks (0 occurrences = use until, or never if both unset).
Reminder(Int32)
StartsAt(DateTime)

When the appointment starts. What the Date means depends on its Kind:

DateTimeKind.Utc: that instant. A recurring series then recurs in UTC, with no daylight saving: 09:00 UTC stays 09:00 UTC all year, which is what was asked for (and is 10:00 on a London clock in summer).

DateTimeKind.Local or Unspecified: that time on this computer's clock. A recurring series recurs in this computer's time zone, as an appointment made in Outlook on this computer does: 09:00 stays 09:00 on the clock across a clock change.

With InTimeZone: an Unspecified Date is a time on a clock in THAT zone; a Utc or Local Date is still the instant it names. A recurring series recurs in that zone.

The zone is stored with every recurring series, so its occurrences fall at the same instants in Outlook on any computer, in any season.

Subject(String)

Details

AllDay(Boolean) method

VB.NET

Public Function AllDay(Optional value As Boolean = True) As AppointmentBuilder

C#

public AppointmentBuilder AllDay(bool value = true);

Parameters

value Boolean

Returns

AppointmentBuilder

Attendee(String, String) method

Add a required attendee. The attendee list is written both as recipients and as the [MS-OXOCAL] attendee-string properties, so it reads back through AppointmentView.Attendees.

VB.NET

Public Function Attendee(name As String, email As String) As AppointmentBuilder

C#

public AppointmentBuilder Attendee(string name, string email);

Parameters

name String
email String

Returns

AppointmentBuilder

BodyText(String) method

VB.NET

Public Function BodyText(s As String) As AppointmentBuilder

C#

public AppointmentBuilder BodyText(string s);

Parameters

s String

Returns

AppointmentBuilder

BusyStatus(Int32) method

0 free, 1 tentative, 2 busy, 3 out of office.

VB.NET

Public Function BusyStatus(status As Integer) As AppointmentBuilder

C#

public AppointmentBuilder BusyStatus(int status);

Parameters

status Int32

Returns

AppointmentBuilder

EndsAt(DateTime) method

When the appointment ends. Read as StartsAt reads its Date.

VB.NET

Public Function EndsAt(d As Date) As AppointmentBuilder

C#

public AppointmentBuilder EndsAt(DateTime d);

Parameters

d DateTime

Returns

AppointmentBuilder

ExcludeOccurrences(DateTime[]) method

Delete specific occurrence dates from the series (e.g. skip a holiday). Call after a Recur… method; the day is what matters.

VB.NET

Public Function ExcludeOccurrences(ParamArray dates As Date()) As AppointmentBuilder

C#

public AppointmentBuilder ExcludeOccurrences(params DateTime[] dates);

Parameters

dates DateTime[]

Returns

AppointmentBuilder

Exceptions

ExceptionCondition
ArgumentNullExceptiondates is Nothing.
InvalidOperationExceptionThe appointment has no recurrence pattern.

Remarks

The builders check their arguments at the call and throw, like any builder: a mistake here is in the calling code, and there is no result object yet to carry a code. Everything that reads or writes a file reports through its result instead.

InTimeZone(String) method

Say which time zone the appointment is in: the zone a Date of no kind given to StartsAt and EndsAt is a clock reading in, and the zone a recurring series recurs in ("every Monday at 09:00 in New York", whatever the season and wherever this code runs). May be called before or after the other methods.

VB.NET

Public Function InTimeZone(timeZoneId As String) As AppointmentBuilder

C#

public AppointmentBuilder InTimeZone(string timeZoneId);

Parameters

timeZoneId String
A Windows time zone id ("Eastern Standard Time") or an IANA id ("America/New_York"); "UTC" for none.

Returns

AppointmentBuilder

Exceptions

ExceptionCondition
ArgumentExceptionThe id is empty, or names no time zone this computer knows.

Location(String) method

VB.NET

Public Function Location(s As String) As AppointmentBuilder

C#

public AppointmentBuilder Location(string s);

Parameters

s String

Returns

AppointmentBuilder

ModifyOccurrence(DateTime, Nullable<DateTime>, Nullable<DateTime>, String, String, Nullable<Int32>) method

Override ONE occurrence of the series — move it and/or change its subject, location or busy status for that instance only ([MS-OXOCAL] exception). Call after a Recur… method. originalDate must be a date the pattern generates (and not an excluded one); a moved occurrence must stay on a day no other occurrence lands on. originalDate is a day on the series' own calendar (the zone it recurs in: see StartsAt). newStart and newEnd are read as StartsAt reads its Date: a Utc or Local Date is an instant, and one of no kind is a clock reading in the series' zone.

VB.NET

Public Function ModifyOccurrence(
    originalDate As Date,
    Optional newStart As Date? = Nothing,
    Optional newEnd As Date? = Nothing,
    Optional newSubject As String = Nothing,
    Optional newLocation As String = Nothing,
    Optional newBusyStatus As Integer? = Nothing
) As AppointmentBuilder

C#

public AppointmentBuilder ModifyOccurrence(
    DateTime originalDate,
    DateTime? newStart = null,
    DateTime? newEnd = null,
    string newSubject = null,
    string newLocation = null,
    int? newBusyStatus = null
);

Parameters

originalDate DateTime
newStart Nullable<DateTime>
newEnd Nullable<DateTime>
newSubject String
newLocation String
newBusyStatus Nullable<Int32>

Returns

AppointmentBuilder

OptionalAttendee(String, String) method

Add an OPTIONAL attendee (the meeting's Cc line).

VB.NET

Public Function OptionalAttendee(name As String, email As String) As AppointmentBuilder

C#

public AppointmentBuilder OptionalAttendee(string name, string email);

Parameters

name String
email String

Returns

AppointmentBuilder

Organiser(String, String) method

The meeting organiser (defaults to the store owner when unset).

VB.NET

Public Function Organiser(name As String, email As String) As AppointmentBuilder

C#

public AppointmentBuilder Organiser(string name, string email);

Parameters

name String
email String

Returns

AppointmentBuilder

RecurDaily(Int32, Int32, Nullable<DateTime>) method

Make this a daily series: every interval days, ending after occurrences (0 = use until, or never if both unset).

VB.NET

Public Function RecurDaily(
    Optional interval As Integer = 1,
    Optional occurrences As Integer = 0,
    Optional until As Date? = Nothing
) As AppointmentBuilder

C#

public AppointmentBuilder RecurDaily(int interval = 1, int occurrences = 0, DateTime? until = null);

Parameters

interval Int32
occurrences Int32
until Nullable<DateTime>

Returns

AppointmentBuilder

RecurMonthly(Int32, Int32, Int32, Nullable<DateTime>) method

Make this a monthly series on day dayOfMonth (1–31; 31 = last), every interval months.

VB.NET

Public Function RecurMonthly(
    dayOfMonth As Integer,
    Optional interval As Integer = 1,
    Optional occurrences As Integer = 0,
    Optional until As Date? = Nothing
) As AppointmentBuilder

C#

public AppointmentBuilder RecurMonthly(
    int dayOfMonth,
    int interval = 1,
    int occurrences = 0,
    DateTime? until = null
);

Parameters

dayOfMonth Int32
interval Int32
occurrences Int32
until Nullable<DateTime>

Returns

AppointmentBuilder

RecurWeekly(RecurDays, Int32, Int32, Nullable<DateTime>) method

Make this a weekly series on days, every interval weeks (0 occurrences = use until, or never if both unset).

VB.NET

Public Function RecurWeekly(
    days As RecurDays,
    Optional interval As Integer = 1,
    Optional occurrences As Integer = 0,
    Optional until As Date? = Nothing
) As AppointmentBuilder

C#

public AppointmentBuilder RecurWeekly(
    RecurDays days,
    int interval = 1,
    int occurrences = 0,
    DateTime? until = null
);

Parameters

days RecurDays
interval Int32
occurrences Int32
until Nullable<DateTime>

Returns

AppointmentBuilder

Reminder(Int32) method

VB.NET

Public Function Reminder(minutesBefore As Integer) As AppointmentBuilder

C#

public AppointmentBuilder Reminder(int minutesBefore);

Parameters

minutesBefore Int32

Returns

AppointmentBuilder

StartsAt(DateTime) method

When the appointment starts. What the Date means depends on its Kind:

DateTimeKind.Utc: that instant. A recurring series then recurs in UTC, with no daylight saving: 09:00 UTC stays 09:00 UTC all year, which is what was asked for (and is 10:00 on a London clock in summer).

DateTimeKind.Local or Unspecified: that time on this computer's clock. A recurring series recurs in this computer's time zone, as an appointment made in Outlook on this computer does: 09:00 stays 09:00 on the clock across a clock change.

With InTimeZone: an Unspecified Date is a time on a clock in THAT zone; a Utc or Local Date is still the instant it names. A recurring series recurs in that zone.

The zone is stored with every recurring series, so its occurrences fall at the same instants in Outlook on any computer, in any season.

VB.NET

Public Function StartsAt(d As Date) As AppointmentBuilder

C#

public AppointmentBuilder StartsAt(DateTime d);

Parameters

d DateTime

Returns

AppointmentBuilder

Subject(String) method

VB.NET

Public Function Subject(s As String) As AppointmentBuilder

C#

public AppointmentBuilder Subject(string s);

Parameters

s String

Returns

AppointmentBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

Author class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

Creates and populates PST stores without Outlook: build typed items with the ItemBuilder factories, then add them to a new or existing store. Every write is an atomic rewrite validated by reopening — the store is never mutated in place.

VB.NET

Public NotInheritable Class Author

C#

public sealed class Author

Methods

NameDescription
AddItems(String, String, IEnumerable<ImportedMessage>, String, DiagnosticsContext, Boolean, String) staticAdd typed items to folderPath of an existing store, writing the result to outPath (may equal storePath). Missing folders in the path are created with the container class matching the item kinds.
AddItemsByFolder(String, String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, DiagnosticsContext, Boolean, String) staticAdd typed items spread across MANY folders in one atomic rewrite: each item is filed by its ImportedMessage.SourceFolder (or defaultFolder when unset), and extraFolders names folders to create empty. Prefer this over a loop of AddItems calls when populating several folders — every AddItems call rewrites the whole store, so a loop costs O(store size × folder count).
CreateFolder(String, String, String, DiagnosticsContext, Boolean) staticCreate an (empty) folder at folderPath in storePath, writing to outPath. Implemented as an add of zero items to the path, which the pipeline satisfies by creating the folder chain.
CreateStore(String, String, Boolean) staticCreate a new empty Unicode PST at path.
CreateStoreWith(String, IEnumerable<ImportedMessage>, String, String, Boolean, DiagnosticsContext) staticCreate a new store at path and drop items into folderPath in one call — the common "author a PST from scratch" case.
CreateStoreWithFolders(String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, String, Boolean, DiagnosticsContext) staticCreate a new store and populate MANY folders in one call — the "author a whole mailbox from scratch" case. One atomic write for the entire tree.
DeleteFolder(String, String, String, Boolean, DiagnosticsContext, Boolean) staticDelete the folder at folderPath. When recursive is False, refuses a non-empty folder.
DeleteItems(String, String, String, Func<PstMessage, Boolean>, DiagnosticsContext, Boolean) staticDelete items in folderPath matching match (Nothing = all items in the folder), writing to outPath.
EditItems(String, String, String, Func<PstMessage, Boolean>, ItemEdit, DiagnosticsContext, Boolean) staticEdit the properties (subject / body / importance — see ItemEdit) of items in folderPath matching match (Nothing = all), writing to outPath. The folder-list subject cache is kept in step.
MoveFolder(String, String, String, String, DiagnosticsContext, Boolean) staticMove the folder at folderPath under a new parent folder newParentPath, writing to outPath.
MoveItems(String, String, String, Func<PstMessage, Boolean>, String, DiagnosticsContext, Boolean) staticMove items matching match (Nothing = all) from fromFolder to toFolder, writing to outPath. Counts on both folders are corrected and the moved items' NBT parent is re-pointed at the destination.
RemoveAttachments(String, String, String, Func<PstMessage, Boolean>, Func<Attachment, Boolean>, DiagnosticsContext, Boolean) staticRemove attachments matching attMatch (Nothing = all) from the messages in folderPath matching msgMatch (Nothing = all), writing to outPath. When a message loses its last attachment its PidTagHasAttachments and mfHasAttach flag are cleared.
RenameFolder(String, String, String, String, DiagnosticsContext, Boolean) staticRename the folder at folderPath to newName, writing to outPath.
SetFolderClass(String, String, String, String, DiagnosticsContext, Boolean) staticSet the folder's container class (PidTagContainerClass) — what marks a folder as holding appointments, contacts or tasks rather than mail — writing to outPath.

Details

AddItems(String, String, IEnumerable<ImportedMessage>, String, DiagnosticsContext, Boolean, String) method static

Add typed items to folderPath of an existing store, writing the result to outPath (may equal storePath). Missing folders in the path are created with the container class matching the item kinds.

VB.NET

Public Shared Function AddItems(
    storePath As String,
    outPath As String,
    items As IEnumerable(Of ImportedMessage),
    Optional folderPath As String = "Authored",
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport AddItems(
    string storePath,
    string outPath,
    IEnumerable<ImportedMessage> items,
    string folderPath = "Authored",
    DiagnosticsContext diag = null,
    bool overwrite = true,
    string storeName = null
);

Parameters

storePath String
outPath String
items IEnumerable<ImportedMessage>
folderPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

AddItemsByFolder(String, String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, DiagnosticsContext, Boolean, String) method static

Add typed items spread across MANY folders in one atomic rewrite: each item is filed by its ImportedMessage.SourceFolder (or defaultFolder when unset), and extraFolders names folders to create empty. Prefer this over a loop of AddItems calls when populating several folders — every AddItems call rewrites the whole store, so a loop costs O(store size × folder count).

VB.NET

Public Shared Function AddItemsByFolder(
    storePath As String,
    outPath As String,
    items As IEnumerable(Of ImportedMessage),
    Optional defaultFolder As String = "Authored",
    Optional extraFolders As IEnumerable(Of String) = Nothing,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport AddItemsByFolder(
    string storePath,
    string outPath,
    IEnumerable<ImportedMessage> items,
    string defaultFolder = "Authored",
    IEnumerable<string> extraFolders = null,
    DiagnosticsContext diag = null,
    bool overwrite = true,
    string storeName = null
);

Parameters

storePath String
outPath String
items IEnumerable<ImportedMessage>
defaultFolder String
extraFolders IEnumerable<String>
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

CreateFolder(String, String, String, DiagnosticsContext, Boolean) method static

Create an (empty) folder at folderPath in storePath, writing to outPath. Implemented as an add of zero items to the path, which the pipeline satisfies by creating the folder chain.

VB.NET

Public Shared Function CreateFolder(
    storePath As String,
    outPath As String,
    folderPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As ImportReport

C#

public static ImportReport CreateFolder(
    string storePath,
    string outPath,
    string folderPath,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
diag DiagnosticsContext
overwrite Boolean

Returns

ImportReport

CreateStore(String, String, Boolean) method static

Create a new empty Unicode PST at path.

VB.NET

Public Shared Function CreateStore(
    path As String,
    Optional storeName As String = Nothing,
    Optional overwrite As Boolean = False
) As FileOpResult

C#

public static FileOpResult CreateStore(string path, string storeName = null, bool overwrite = false);

Parameters

path String
storeName String
overwrite Boolean

Returns

FileOpResult

CreateStoreWith(String, IEnumerable<ImportedMessage>, String, String, Boolean, DiagnosticsContext) method static

Create a new store at path and drop items into folderPath in one call — the common "author a PST from scratch" case.

VB.NET

Public Shared Function CreateStoreWith(
    path As String,
    items As IEnumerable(Of ImportedMessage),
    Optional folderPath As String = "Authored",
    Optional storeName As String = Nothing,
    Optional overwrite As Boolean = False,
    Optional diag As DiagnosticsContext = Nothing
) As ImportReport

C#

public static ImportReport CreateStoreWith(
    string path,
    IEnumerable<ImportedMessage> items,
    string folderPath = "Authored",
    string storeName = null,
    bool overwrite = false,
    DiagnosticsContext diag = null
);

Parameters

path String
items IEnumerable<ImportedMessage>
folderPath String
storeName String
overwrite Boolean
diag DiagnosticsContext

Returns

ImportReport

CreateStoreWithFolders(String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, String, Boolean, DiagnosticsContext) method static

Create a new store and populate MANY folders in one call — the "author a whole mailbox from scratch" case. One atomic write for the entire tree.

VB.NET

Public Shared Function CreateStoreWithFolders(
    path As String,
    items As IEnumerable(Of ImportedMessage),
    Optional defaultFolder As String = "Authored",
    Optional extraFolders As IEnumerable(Of String) = Nothing,
    Optional storeName As String = Nothing,
    Optional overwrite As Boolean = False,
    Optional diag As DiagnosticsContext = Nothing
) As ImportReport

C#

public static ImportReport CreateStoreWithFolders(
    string path,
    IEnumerable<ImportedMessage> items,
    string defaultFolder = "Authored",
    IEnumerable<string> extraFolders = null,
    string storeName = null,
    bool overwrite = false,
    DiagnosticsContext diag = null
);

Parameters

path String
items IEnumerable<ImportedMessage>
defaultFolder String
extraFolders IEnumerable<String>
storeName String
overwrite Boolean
diag DiagnosticsContext

Returns

ImportReport

DeleteFolder(String, String, String, Boolean, DiagnosticsContext, Boolean) method static

Delete the folder at folderPath. When recursive is False, refuses a non-empty folder.

VB.NET

Public Shared Function DeleteFolder(
    storePath As String,
    outPath As String,
    folderPath As String,
    Optional recursive As Boolean = False,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport DeleteFolder(
    string storePath,
    string outPath,
    string folderPath,
    bool recursive = false,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
recursive Boolean
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

DeleteItems(String, String, String, Func<PstMessage, Boolean>, DiagnosticsContext, Boolean) method static

Delete items in folderPath matching match (Nothing = all items in the folder), writing to outPath.

VB.NET

Public Shared Function DeleteItems(
    storePath As String,
    outPath As String,
    folderPath As String,
    match As Func(Of PstMessage, Boolean),
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport DeleteItems(
    string storePath,
    string outPath,
    string folderPath,
    Func<PstMessage, bool> match,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
match Func<PstMessage, Boolean>
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

EditItems(String, String, String, Func<PstMessage, Boolean>, ItemEdit, DiagnosticsContext, Boolean) method static

Edit the properties (subject / body / importance — see ItemEdit) of items in folderPath matching match (Nothing = all), writing to outPath. The folder-list subject cache is kept in step.

VB.NET

Public Shared Function EditItems(
    storePath As String,
    outPath As String,
    folderPath As String,
    match As Func(Of PstMessage, Boolean),
    edit As ItemEdit,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport EditItems(
    string storePath,
    string outPath,
    string folderPath,
    Func<PstMessage, bool> match,
    ItemEdit edit,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
match Func<PstMessage, Boolean>
edit ItemEdit
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

MoveFolder(String, String, String, String, DiagnosticsContext, Boolean) method static

Move the folder at folderPath under a new parent folder newParentPath, writing to outPath.

VB.NET

Public Shared Function MoveFolder(
    storePath As String,
    outPath As String,
    folderPath As String,
    newParentPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport MoveFolder(
    string storePath,
    string outPath,
    string folderPath,
    string newParentPath,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
newParentPath String
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

MoveItems(String, String, String, Func<PstMessage, Boolean>, String, DiagnosticsContext, Boolean) method static

Move items matching match (Nothing = all) from fromFolder to toFolder, writing to outPath. Counts on both folders are corrected and the moved items' NBT parent is re-pointed at the destination.

VB.NET

Public Shared Function MoveItems(
    storePath As String,
    outPath As String,
    fromFolder As String,
    match As Func(Of PstMessage, Boolean),
    toFolder As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport MoveItems(
    string storePath,
    string outPath,
    string fromFolder,
    Func<PstMessage, bool> match,
    string toFolder,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
fromFolder String
match Func<PstMessage, Boolean>
toFolder String
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

RemoveAttachments(String, String, String, Func<PstMessage, Boolean>, Func<Attachment, Boolean>, DiagnosticsContext, Boolean) method static

Remove attachments matching attMatch (Nothing = all) from the messages in folderPath matching msgMatch (Nothing = all), writing to outPath. When a message loses its last attachment its PidTagHasAttachments and mfHasAttach flag are cleared.

VB.NET

Public Shared Function RemoveAttachments(
    storePath As String,
    outPath As String,
    folderPath As String,
    msgMatch As Func(Of PstMessage, Boolean),
    attMatch As Func(Of Attachment, Boolean),
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport RemoveAttachments(
    string storePath,
    string outPath,
    string folderPath,
    Func<PstMessage, bool> msgMatch,
    Func<Attachment, bool> attMatch,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
msgMatch Func<PstMessage, Boolean>
attMatch Func<Attachment, Boolean>
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

RenameFolder(String, String, String, String, DiagnosticsContext, Boolean) method static

Rename the folder at folderPath to newName, writing to outPath.

VB.NET

Public Shared Function RenameFolder(
    storePath As String,
    outPath As String,
    folderPath As String,
    newName As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport RenameFolder(
    string storePath,
    string outPath,
    string folderPath,
    string newName,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
newName String
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

SetFolderClass(String, String, String, String, DiagnosticsContext, Boolean) method static

Set the folder's container class (PidTagContainerClass) — what marks a folder as holding appointments, contacts or tasks rather than mail — writing to outPath.

VB.NET

Public Shared Function SetFolderClass(
    storePath As String,
    outPath As String,
    folderPath As String,
    containerClass As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As EditReport

C#

public static EditReport SetFolderClass(
    string storePath,
    string outPath,
    string folderPath,
    string containerClass,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

storePath String
outPath String
folderPath String
containerClass String
One of the FolderClass constants, e.g. FolderClass.Appointment. Any string is accepted; unrecognised values are simply ignored by clients.
diag DiagnosticsContext
overwrite Boolean

Returns

EditReport

Remarks

A folder created by CreateFolder is mail ("IPF.Note") until this is called, so this is the step that turns an authored folder into a real Calendar or Contacts folder that Outlook renders with the right view.

The value is written to both the folder's own property context and its row in the parent's hierarchy table, because different readers consult different ones.

Example

Author.CreateFolder("data.pst", "step1.pst", "Team Calendar")
Author.SetFolderClass("step1.pst", "out.pst", "Team Calendar", FolderClass.Appointment)

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

AuthoringSession class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

Accumulates rename / move / delete / remove-attachment edits and applies them in a single atomic, reopen-validated rewrite. Fluent: chain the queue methods, then Commit.

VB.NET

Public NotInheritable Class AuthoringSession

C#

public sealed class AuthoringSession

Constructors

NameDescription
AuthoringSession(String, DiagnosticsContext)Start a session over the store at storePath.

Properties

NameDescription
CountNumber of edits queued so far.

Methods

NameDescription
Commit(String, Boolean)Apply every queued edit to outPath in one atomic rewrite. The returned EditReport carries the combined per-kind change counts.
DeleteFolder(String, Boolean)
DeleteItems(String, Func<PstMessage, Boolean>)
EditItems(String, Func<PstMessage, Boolean>, ItemEdit)
MoveFolder(String, String)
MoveItems(String, Func<PstMessage, Boolean>, String)
RemoveAttachments(String, Func<PstMessage, Boolean>, Func<Attachment, Boolean>)
RenameFolder(String, String)
SetFolderClass(String, String)Set the folder's container class (PidTagContainerClass) — what marks it as holding appointments, contacts or tasks rather than mail.

Details

AuthoringSession(String, DiagnosticsContext) constructor

Start a session over the store at storePath.

VB.NET

Public Sub New(storePath As String, Optional diag As DiagnosticsContext = Nothing)

C#

public AuthoringSession(string storePath, DiagnosticsContext diag = null);

Parameters

storePath String
diag DiagnosticsContext

Count property

Number of edits queued so far.

VB.NET

Public ReadOnly Property Count As Integer

C#

public int Count { get; }

Property value

Int32

Commit(String, Boolean) method

Apply every queued edit to outPath in one atomic rewrite. The returned EditReport carries the combined per-kind change counts.

VB.NET

Public Function Commit(outPath As String, Optional overwrite As Boolean = True) As EditReport

C#

public EditReport Commit(string outPath, bool overwrite = true);

Parameters

outPath String
overwrite Boolean

Returns

EditReport

DeleteFolder(String, Boolean) method

VB.NET

Public Function DeleteFolder(folderPath As String, Optional recursive As Boolean = False) As AuthoringSession

C#

public AuthoringSession DeleteFolder(string folderPath, bool recursive = false);

Parameters

folderPath String
recursive Boolean

Returns

AuthoringSession

DeleteItems(String, Func<PstMessage, Boolean>) method

VB.NET

Public Function DeleteItems(folderPath As String, match As Func(Of PstMessage, Boolean)) As AuthoringSession

C#

public AuthoringSession DeleteItems(string folderPath, Func<PstMessage, bool> match);

Parameters

folderPath String
match Func<PstMessage, Boolean>

Returns

AuthoringSession

EditItems(String, Func<PstMessage, Boolean>, ItemEdit) method

VB.NET

Public Function EditItems(
    folderPath As String,
    match As Func(Of PstMessage, Boolean),
    edit As ItemEdit
) As AuthoringSession

C#

public AuthoringSession EditItems(string folderPath, Func<PstMessage, bool> match, ItemEdit edit);

Parameters

folderPath String
match Func<PstMessage, Boolean>
edit ItemEdit

Returns

AuthoringSession

MoveFolder(String, String) method

VB.NET

Public Function MoveFolder(folderPath As String, newParentPath As String) As AuthoringSession

C#

public AuthoringSession MoveFolder(string folderPath, string newParentPath);

Parameters

folderPath String
newParentPath String

Returns

AuthoringSession

MoveItems(String, Func<PstMessage, Boolean>, String) method

VB.NET

Public Function MoveItems(
    fromFolder As String,
    match As Func(Of PstMessage, Boolean),
    toFolder As String
) As AuthoringSession

C#

public AuthoringSession MoveItems(string fromFolder, Func<PstMessage, bool> match, string toFolder);

Parameters

fromFolder String
match Func<PstMessage, Boolean>
toFolder String

Returns

AuthoringSession

RemoveAttachments(String, Func<PstMessage, Boolean>, Func<Attachment, Boolean>) method

VB.NET

Public Function RemoveAttachments(
    folderPath As String,
    msgMatch As Func(Of PstMessage, Boolean),
    attMatch As Func(Of Attachment, Boolean)
) As AuthoringSession

C#

public AuthoringSession RemoveAttachments(
    string folderPath,
    Func<PstMessage, bool> msgMatch,
    Func<Attachment, bool> attMatch
);

Parameters

folderPath String
msgMatch Func<PstMessage, Boolean>
attMatch Func<Attachment, Boolean>

Returns

AuthoringSession

RenameFolder(String, String) method

VB.NET

Public Function RenameFolder(folderPath As String, newName As String) As AuthoringSession

C#

public AuthoringSession RenameFolder(string folderPath, string newName);

Parameters

folderPath String
newName String

Returns

AuthoringSession

SetFolderClass(String, String) method

Set the folder's container class (PidTagContainerClass) — what marks it as holding appointments, contacts or tasks rather than mail.

VB.NET

Public Function SetFolderClass(folderPath As String, containerClass As String) As AuthoringSession

C#

public AuthoringSession SetFolderClass(string folderPath, string containerClass);

Parameters

folderPath String
containerClass String
One of the FolderClass constants, e.g. FolderClass.Appointment.

Returns

AuthoringSession

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

ContactBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class ContactBuilder
    Inherits ItemBuilderBase

C#

public sealed class ContactBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
Address(String, String)Business and home postal addresses (each a single multi-line string).
Anniversary(DateTime)The contact's wedding anniversary: a calendar day, as Birthday.
Birthday(DateTime)The contact's birthday: a calendar day (the date part of d as given; any time of day and the Date's kind are ignored).
Company(String)
Department(String)
DisplayName(String)
Email(String, Int32)
Fax(String)
JobTitle(String)
Name(String, String, String)
Notes(String)Free-text notes — stored as the contact item's body.
Phone(String, String, String)
Photo(Byte[], String)Attach a contact photo (JPEG bytes). Written with PidTagAttachmentContactPhoto + PidLidHasPicture so Outlook shows it on the card.
WebPage(String)

Details

Address(String, String) method

Business and home postal addresses (each a single multi-line string).

VB.NET

Public Function Address(business As String, Optional home As String = "") As ContactBuilder

C#

public ContactBuilder Address(string business, string home = "");

Parameters

business String
home String

Returns

ContactBuilder

Anniversary(DateTime) method

The contact's wedding anniversary: a calendar day, as Birthday.

VB.NET

Public Function Anniversary(d As Date) As ContactBuilder

C#

public ContactBuilder Anniversary(DateTime d);

Parameters

d DateTime

Returns

ContactBuilder

Birthday(DateTime) method

The contact's birthday: a calendar day (the date part of d as given; any time of day and the Date's kind are ignored).

VB.NET

Public Function Birthday(d As Date) As ContactBuilder

C#

public ContactBuilder Birthday(DateTime d);

Parameters

d DateTime

Returns

ContactBuilder

Company(String) method

VB.NET

Public Function Company(s As String) As ContactBuilder

C#

public ContactBuilder Company(string s);

Parameters

s String

Returns

ContactBuilder

Department(String) method

VB.NET

Public Function Department(s As String) As ContactBuilder

C#

public ContactBuilder Department(string s);

Parameters

s String

Returns

ContactBuilder

DisplayName(String) method

VB.NET

Public Function DisplayName(s As String) As ContactBuilder

C#

public ContactBuilder DisplayName(string s);

Parameters

s String

Returns

ContactBuilder

Email(String, Int32) method

VB.NET

Public Function Email(address As String, Optional slot As Integer = 1) As ContactBuilder

C#

public ContactBuilder Email(string address, int slot = 1);

Parameters

address String
slot Int32

Returns

ContactBuilder

Fax(String) method

VB.NET

Public Function Fax(business As String) As ContactBuilder

C#

public ContactBuilder Fax(string business);

Parameters

business String

Returns

ContactBuilder

JobTitle(String) method

VB.NET

Public Function JobTitle(s As String) As ContactBuilder

C#

public ContactBuilder JobTitle(string s);

Parameters

s String

Returns

ContactBuilder

Name(String, String, String) method

VB.NET

Public Function Name(given As String, surname As String, Optional middle As String = "") As ContactBuilder

C#

public ContactBuilder Name(string given, string surname, string middle = "");

Parameters

given String
surname String
middle String

Returns

ContactBuilder

Notes(String) method

Free-text notes — stored as the contact item's body.

VB.NET

Public Function Notes(s As String) As ContactBuilder

C#

public ContactBuilder Notes(string s);

Parameters

s String

Returns

ContactBuilder

Phone(String, String, String) method

VB.NET

Public Function Phone(
    business As String,
    Optional home As String = "",
    Optional mobile As String = ""
) As ContactBuilder

C#

public ContactBuilder Phone(string business, string home = "", string mobile = "");

Parameters

business String
home String
mobile String

Returns

ContactBuilder

Photo(Byte[], String) method

Attach a contact photo (JPEG bytes). Written with PidTagAttachmentContactPhoto + PidLidHasPicture so Outlook shows it on the card.

VB.NET

Public Function Photo(jpeg As Byte(), Optional fileName As String = "ContactPicture.jpg") As ContactBuilder

C#

public ContactBuilder Photo(byte[] jpeg, string fileName = "ContactPicture.jpg");

Parameters

jpeg Byte[]
fileName String

Returns

ContactBuilder

WebPage(String) method

VB.NET

Public Function WebPage(s As String) As ContactBuilder

C#

public ContactBuilder WebPage(string s);

Parameters

s String

Returns

ContactBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

DistListBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class DistListBuilder
    Inherits ItemBuilderBase

C#

public sealed class DistListBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
AddMember(String, String)Add a one-off member (display name + SMTP address).
Name(String)The list's display name.

Details

AddMember(String, String) method

Add a one-off member (display name + SMTP address).

VB.NET

Public Function AddMember(displayName As String, email As String) As DistListBuilder

C#

public DistListBuilder AddMember(string displayName, string email);

Parameters

displayName String
email String

Returns

DistListBuilder

Name(String) method

The list's display name.

VB.NET

Public Function Name(s As String) As DistListBuilder

C#

public DistListBuilder Name(string s);

Parameters

s String

Returns

DistListBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

ItemBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

Entry point for building typed items: ItemBuilder.Mail(), .Appointment(), .Contact(), .Task(), .Note().

VB.NET

Public NotInheritable Class ItemBuilder

C#

public sealed class ItemBuilder

Methods

NameDescription
Appointment() static
Contact() static
DistributionList() static
Journal() static
Mail() static
Note() static
Rss() static
Task() static

Details

Appointment() method static

VB.NET

Public Shared Function Appointment() As AppointmentBuilder

C#

public static AppointmentBuilder Appointment();

Returns

AppointmentBuilder

Contact() method static

VB.NET

Public Shared Function Contact() As ContactBuilder

C#

public static ContactBuilder Contact();

Returns

ContactBuilder

DistributionList() method static

VB.NET

Public Shared Function DistributionList() As DistListBuilder

C#

public static DistListBuilder DistributionList();

Returns

DistListBuilder

Journal() method static

VB.NET

Public Shared Function Journal() As JournalBuilder

C#

public static JournalBuilder Journal();

Returns

JournalBuilder

Mail() method static

VB.NET

Public Shared Function Mail() As MailBuilder

C#

public static MailBuilder Mail();

Returns

MailBuilder

Note() method static

VB.NET

Public Shared Function Note() As NoteBuilder

C#

public static NoteBuilder Note();

Returns

NoteBuilder

Rss() method static

VB.NET

Public Shared Function Rss() As RssBuilder

C#

public static RssBuilder Rss();

Returns

RssBuilder

Task() method static

VB.NET

Public Shared Function Task() As TaskBuilder

C#

public static TaskBuilder Task();

Returns

TaskBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

ItemBuilderBase class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

Shared surface: subject/body/attachments and the terminal Build.

VB.NET

Public MustInherit Class ItemBuilderBase

C#

public abstract class ItemBuilderBase

Derived: AppointmentBuilder, ContactBuilder, DistListBuilder, JournalBuilder, MailBuilder, NoteBuilder, RssBuilder, TaskBuilder

Methods

NameDescription
Build()The finished neutral item, ready for Author / StoreImporter.

Details

Build() method

The finished neutral item, ready for Author / StoreImporter.

VB.NET

Public Function Build() As ImportedMessage

C#

public ImportedMessage Build();

Returns

ImportedMessage

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

JournalBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class JournalBuilder
    Inherits ItemBuilderBase

C#

public sealed class JournalBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
BodyText(String)
DurationMinutes(Int32)
EndsAt(DateTime)
JournalType(String)Free-text activity type, e.g. "Phone call".
StartsAt(DateTime)
Subject(String)

Details

BodyText(String) method

VB.NET

Public Function BodyText(s As String) As JournalBuilder

C#

public JournalBuilder BodyText(string s);

Parameters

s String

Returns

JournalBuilder

DurationMinutes(Int32) method

VB.NET

Public Function DurationMinutes(minutes As Integer) As JournalBuilder

C#

public JournalBuilder DurationMinutes(int minutes);

Parameters

minutes Int32

Returns

JournalBuilder

EndsAt(DateTime) method

VB.NET

Public Function EndsAt(d As Date) As JournalBuilder

C#

public JournalBuilder EndsAt(DateTime d);

Parameters

d DateTime

Returns

JournalBuilder

JournalType(String) method

Free-text activity type, e.g. "Phone call".

VB.NET

Public Function JournalType(s As String) As JournalBuilder

C#

public JournalBuilder JournalType(string s);

Parameters

s String

Returns

JournalBuilder

StartsAt(DateTime) method

VB.NET

Public Function StartsAt(d As Date) As JournalBuilder

C#

public JournalBuilder StartsAt(DateTime d);

Parameters

d DateTime

Returns

JournalBuilder

Subject(String) method

VB.NET

Public Function Subject(s As String) As JournalBuilder

C#

public JournalBuilder Subject(string s);

Parameters

s String

Returns

JournalBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

MailBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class MailBuilder
    Inherits ItemBuilderBase

C#

public sealed class MailBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
AddAttachment(String, Byte[], String)
AddEmbeddedMessage(String, ImportedMessage)
Bcc(String, String)
BodyHtml(String)
BodyText(String)
Cc(String, String)
From(String, String)
Importance(Int32)0 low, 1 normal, 2 high.
MessageId(String)
Read(Boolean)Mark the item read (default) or unread.
SentOn(DateTime)
Subject(String)
To(String, String)

Details

AddAttachment(String, Byte[], String) method

VB.NET

Public Function AddAttachment(
    fileName As String,
    data As Byte(),
    Optional mimeType As String = "application/octet-stream"
) As MailBuilder

C#

public MailBuilder AddAttachment(
    string fileName,
    byte[] data,
    string mimeType = "application/octet-stream"
);

Parameters

fileName String
data Byte[]
mimeType String

Returns

MailBuilder

AddEmbeddedMessage(String, ImportedMessage) method

VB.NET

Public Function AddEmbeddedMessage(fileName As String, embedded As ImportedMessage) As MailBuilder

C#

public MailBuilder AddEmbeddedMessage(string fileName, ImportedMessage embedded);

Parameters

fileName String
embedded ImportedMessage

Returns

MailBuilder

Bcc(String, String) method

VB.NET

Public Function Bcc(name As String, email As String) As MailBuilder

C#

public MailBuilder Bcc(string name, string email);

Parameters

name String
email String

Returns

MailBuilder

BodyHtml(String) method

VB.NET

Public Function BodyHtml(s As String) As MailBuilder

C#

public MailBuilder BodyHtml(string s);

Parameters

s String

Returns

MailBuilder

BodyText(String) method

VB.NET

Public Function BodyText(s As String) As MailBuilder

C#

public MailBuilder BodyText(string s);

Parameters

s String

Returns

MailBuilder

Cc(String, String) method

VB.NET

Public Function Cc(name As String, email As String) As MailBuilder

C#

public MailBuilder Cc(string name, string email);

Parameters

name String
email String

Returns

MailBuilder

From(String, String) method

VB.NET

Public Function From(name As String, email As String) As MailBuilder

C#

public MailBuilder From(string name, string email);

Parameters

name String
email String

Returns

MailBuilder

Importance(Int32) method

0 low, 1 normal, 2 high.

VB.NET

Public Function Importance(level As Integer) As MailBuilder

C#

public MailBuilder Importance(int level);

Parameters

level Int32

Returns

MailBuilder

MessageId(String) method

VB.NET

Public Function MessageId(id As String) As MailBuilder

C#

public MailBuilder MessageId(string id);

Parameters

id String

Returns

MailBuilder

Read(Boolean) method

Mark the item read (default) or unread.

VB.NET

Public Function Read(Optional value As Boolean = True) As MailBuilder

C#

public MailBuilder Read(bool value = true);

Parameters

value Boolean

Returns

MailBuilder

SentOn(DateTime) method

VB.NET

Public Function SentOn(d As Date) As MailBuilder

C#

public MailBuilder SentOn(DateTime d);

Parameters

d DateTime

Returns

MailBuilder

Subject(String) method

VB.NET

Public Function Subject(s As String) As MailBuilder

C#

public MailBuilder Subject(string s);

Parameters

s String

Returns

MailBuilder

To(String, String) method

VB.NET

Public Function To(name As String, email As String) As MailBuilder

C#

public MailBuilder To(string name, string email);

Parameters

name String
email String

Returns

MailBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

NoteBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class NoteBuilder
    Inherits ItemBuilderBase

C#

public sealed class NoteBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
Color(Int32)0 blue, 1 green, 2 pink, 3 yellow, 4 white.
Size(Int32, Int32)
Subject(String)
Text(String)

Details

Color(Int32) method

0 blue, 1 green, 2 pink, 3 yellow, 4 white.

VB.NET

Public Function Color(c As Integer) As NoteBuilder

C#

public NoteBuilder Color(int c);

Parameters

c Int32

Returns

NoteBuilder

Size(Int32, Int32) method

VB.NET

Public Function Size(width As Integer, height As Integer) As NoteBuilder

C#

public NoteBuilder Size(int width, int height);

Parameters

width Int32
height Int32

Returns

NoteBuilder

Subject(String) method

VB.NET

Public Function Subject(s As String) As NoteBuilder

C#

public NoteBuilder Subject(string s);

Parameters

s String

Returns

NoteBuilder

Text(String) method

VB.NET

Public Function Text(s As String) As NoteBuilder

C#

public NoteBuilder Text(string s);

Parameters

s String

Returns

NoteBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

RssBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

An RSS feed item (IPM.Post.Rss).

VB.NET

Public NotInheritable Class RssBuilder
    Inherits ItemBuilderBase

C#

public sealed class RssBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
Article(String, String)The article's own URL and feed-unique id.
BodyHtml(String)
BodyText(String)
Channel(String, String)The feed this item came from: display name and channel URL.
PostedOn(DateTime)
Read(Boolean)
Subject(String)

Details

Article(String, String) method

The article's own URL and feed-unique id.

VB.NET

Public Function Article(url As String, Optional guid As String = "") As RssBuilder

C#

public RssBuilder Article(string url, string guid = "");

Parameters

url String
guid String

Returns

RssBuilder

BodyHtml(String) method

VB.NET

Public Function BodyHtml(s As String) As RssBuilder

C#

public RssBuilder BodyHtml(string s);

Parameters

s String

Returns

RssBuilder

BodyText(String) method

VB.NET

Public Function BodyText(s As String) As RssBuilder

C#

public RssBuilder BodyText(string s);

Parameters

s String

Returns

RssBuilder

Channel(String, String) method

The feed this item came from: display name and channel URL.

VB.NET

Public Function Channel(name As String, url As String) As RssBuilder

C#

public RssBuilder Channel(string name, string url);

Parameters

name String
url String

Returns

RssBuilder

PostedOn(DateTime) method

VB.NET

Public Function PostedOn(d As Date) As RssBuilder

C#

public RssBuilder PostedOn(DateTime d);

Parameters

d DateTime

Returns

RssBuilder

Read(Boolean) method

VB.NET

Public Function Read(Optional value As Boolean = True) As RssBuilder

C#

public RssBuilder Read(bool value = true);

Parameters

value Boolean

Returns

RssBuilder

Subject(String) method

VB.NET

Public Function Subject(s As String) As RssBuilder

C#

public RssBuilder Subject(string s);

Parameters

s String

Returns

RssBuilder

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace

TaskBuilder class

Namespace: Bastion.Pst.Authoring · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class TaskBuilder
    Inherits ItemBuilderBase

C#

public sealed class TaskBuilder : ItemBuilderBase

Inherits: ItemBuilderBase

Methods

NameDescription
BodyText(String)
CompletedOn(DateTime)Mark the task complete, on this day (a calendar day, as StartDate).
DueDate(DateTime)The day the task is due. A calendar day, as StartDate.
Owner(String)
PercentComplete(Double)0..1.
StartDate(DateTime)The day work on the task starts. A task's dates are calendar DAYS, not instants: the day is the date part of d (of its local time, when it is a UTC Date), and a task that starts on 6 July starts on 6 July in Outlook in any time zone. Any time of day is dropped.
Status(Int32)0 not started, 1 in progress, 2 complete, 3 waiting, 4 deferred.
Subject(String)

Details

BodyText(String) method

VB.NET

Public Function BodyText(s As String) As TaskBuilder

C#

public TaskBuilder BodyText(string s);

Parameters

s String

Returns

TaskBuilder

CompletedOn(DateTime) method

Mark the task complete, on this day (a calendar day, as StartDate).

VB.NET

Public Function CompletedOn(d As Date) As TaskBuilder

C#

public TaskBuilder CompletedOn(DateTime d);

Parameters

d DateTime

Returns

TaskBuilder

DueDate(DateTime) method

The day the task is due. A calendar day, as StartDate.

VB.NET

Public Function DueDate(d As Date) As TaskBuilder

C#

public TaskBuilder DueDate(DateTime d);

Parameters

d DateTime

Returns

TaskBuilder

Owner(String) method

VB.NET

Public Function Owner(s As String) As TaskBuilder

C#

public TaskBuilder Owner(string s);

Parameters

s String

Returns

TaskBuilder

PercentComplete(Double) method

0..1.

VB.NET

Public Function PercentComplete(fraction As Double) As TaskBuilder

C#

public TaskBuilder PercentComplete(double fraction);

Parameters

fraction Double

Returns

TaskBuilder

StartDate(DateTime) method

The day work on the task starts. A task's dates are calendar DAYS, not instants: the day is the date part of d (of its local time, when it is a UTC Date), and a task that starts on 6 July starts on 6 July in Outlook in any time zone. Any time of day is dropped.

VB.NET

Public Function StartDate(d As Date) As TaskBuilder

C#

public TaskBuilder StartDate(DateTime d);

Parameters

d DateTime

Returns

TaskBuilder

Status(Int32) method

0 not started, 1 in progress, 2 complete, 3 waiting, 4 deferred.

VB.NET

Public Function Status(value As Integer) As TaskBuilder

C#

public TaskBuilder Status(int value);

Parameters

value Int32

Returns

TaskBuilder

Subject(String) method

VB.NET

Public Function Subject(s As String) As TaskBuilder

C#

public TaskBuilder Subject(string s);

Parameters

s String

Returns

TaskBuilder

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Convert namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
DedupRemoves duplicate email during a merge or conversion. A message is a duplicate when its Internet Message-ID matches one already kept, or, when it has none, its subject, sender name and delivery time do (Outlook's hidden marker at the start of a stored subject is ignored). Only email (message class IPM.Note…) is checked; contacts, appointments, tasks, notes and journal entries are always kept. The first copy is kept. By default a duplicate is one bound for the SAME destination folder, and under the Stacked layout the same source too; AcrossFolders widens that to the whole output.
DestinationExistsExceptionThrown at the start of a write operation when the destination already exists and overwrite was not requested. The host application can catch this and prompt the user.
EditReportResult of a store edit: the standard error contract plus how many items/folders changed.
ItemEditProperty changes to apply to matching items (any field left Nothing is unchanged).
MergePreflightScans merge sources for corruption before the merge begins, and repairs the ones the caller agrees to repair. See Scan.
MergeReportOutcome of a merge. ErrorCode 0 = success; on failure ErrorDescription says why (ToString() renders "code: description").
MergeVerificationThe outcome of checking a merge's output against its sources.
OrphanScanResultWhat StoreMerger.OrphanScan found. ErrorCode 0 = every table was read.
PasswordChangeReportOutcome of StorePassword.SetPassword / StorePassword.RemovePassword: what was written, the structural validation of the output, and the password state read back from the output as evidence.
PasswordStatusResult of StorePassword.GetStatus: whether the file has an open password and the stored CRC value.
PreflightReportOutcome of a pre-merge scan (and repair, when one was run).
SourceHealthOne source file's pre-merge verdict.
SplitPart
SplitReportOutcome of a split. ErrorCode 0 = success. Parts lists the files that exist when the call returns: on any failure or cancellation the parts are removed again and the list is empty.
StoreConverter
StoreMerger
StorePasswordRead, set or remove the password of a PST file. A PST password is a stored CRC hash, not encryption — it controls Outlook's open prompt only; the data itself is never encrypted by it. SetPassword/RemovePassword write a new file (atomic, validated): pass the same path as source and output with overwrite:=True to change in place.
StoreSplitter
SweepPlanResultWhat StoreMerger.SweepPlan found a sweep would change. ErrorCode 0 = every folder table was read.
VolumeInfoOne output volume produced by a capped merge.
VolumeReportOutcome of a capped (volume-split) merge. ErrorCode 0 = success.

Enumerations

NameDescription
MergeLayoutHow a merge lays out the sources in the output store.
RepairChoiceWhat the caller wants done about one corrupt source. The "…ToAll" answers apply to every remaining corrupt file so the user is not asked again; Cancel abandons the whole operation.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

Dedup class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Removes duplicate email during a merge or conversion. A message is a duplicate when its Internet Message-ID matches one already kept, or, when it has none, its subject, sender name and delivery time do (Outlook's hidden marker at the start of a stored subject is ignored). Only email (message class IPM.Note…) is checked; contacts, appointments, tasks, notes and journal entries are always kept. The first copy is kept. By default a duplicate is one bound for the SAME destination folder, and under the Stacked layout the same source too; AcrossFolders widens that to the whole output.

VB.NET

Public NotInheritable Class Dedup

C#

public sealed class Dedup

Constructors

NameDescription
Dedup()

Properties

NameDescription
AcrossFoldersCollapse duplicates across the WHOLE output instead of within each folder. Default False, which is the behaviour to keep unless a user has explicitly asked for otherwise. False (default): a message is a duplicate only of another copy in the SAME destination folder. The folder tree survives the merge exactly as the user built it — the same mail filed in "Inbox\Sales" and "Inbox\Sales 2025" is kept in both. True: one copy of each message survives anywhere in the output, so every other copy is removed no matter which folder it was filed in. This compacts the folder tree. Folders whose entire contents existed elsewhere are left empty, and with pruneEmpty set they are deleted outright — the user's filing is discarded, not just the redundant bytes. On a real 305 GB corpus this emptied 49 non-empty folders. Only set it where the person choosing has been told that plainly and wants the smallest possible output more than they want their folders.
BaseDropsBase-store contents tables needing row drops (base-internal dedup): the first copy of each message is kept, later copies within the same store are dropped. Populated by Seed.
BaseDuplicateCountTotal base-internal duplicates marked for removal by Seed.

Details

Dedup() constructor

VB.NET

Public Sub New()

C#

public Dedup();

AcrossFolders property

Collapse duplicates across the WHOLE output instead of within each folder. Default False, which is the behaviour to keep unless a user has explicitly asked for otherwise. False (default): a message is a duplicate only of another copy in the SAME destination folder. The folder tree survives the merge exactly as the user built it — the same mail filed in "Inbox\Sales" and "Inbox\Sales 2025" is kept in both. True: one copy of each message survives anywhere in the output, so every other copy is removed no matter which folder it was filed in. This compacts the folder tree. Folders whose entire contents existed elsewhere are left empty, and with pruneEmpty set they are deleted outright — the user's filing is discarded, not just the redundant bytes. On a real 305 GB corpus this emptied 49 non-empty folders. Only set it where the person choosing has been told that plainly and wants the smallest possible output more than they want their folders.

VB.NET

Public Property AcrossFolders As Boolean

C#

public bool AcrossFolders { get; set; }

Property value

Boolean

BaseDrops property

Base-store contents tables needing row drops (base-internal dedup): the first copy of each message is kept, later copies within the same store are dropped. Populated by Seed.

VB.NET

Public ReadOnly Property BaseDrops As Dictionary(Of UInteger, HashSet(Of UInteger))

C#

public Dictionary<uint, HashSet<uint>> BaseDrops { get; }

Property value

Dictionary<UInt32, HashSet<UInt32>>

BaseDuplicateCount property

Total base-internal duplicates marked for removal by Seed.

VB.NET

Public ReadOnly Property BaseDuplicateCount As Integer

C#

public int BaseDuplicateCount { get; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

DestinationExistsException class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Thrown at the start of a write operation when the destination already exists and overwrite was not requested. The host application can catch this and prompt the user.

VB.NET

Public Class DestinationExistsException
    Inherits IOException

C#

public class DestinationExistsException : IOException

Inherits: IOException

Constructors

NameDescription
DestinationExistsException(String)

Properties

NameDescription
DestinationPathThe destination path that already exists.

Details

DestinationExistsException(String) constructor

VB.NET

Public Sub New(path As String)

C#

public DestinationExistsException(string path);

Parameters

path String

DestinationPath property

The destination path that already exists.

VB.NET

Public ReadOnly Property DestinationPath As String

C#

public string DestinationPath { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

EditReport class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Result of a store edit: the standard error contract plus how many items/folders changed.

VB.NET

Public NotInheritable Class EditReport
    Inherits OperationResult

C#

public sealed class EditReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
EditReport()

Properties

NameDescription
AttachmentsRemoved
FoldersDeleted
FoldersMoved
FoldersReclassified
FoldersRenamed
ItemsDeleted
ItemsEdited
ItemsMoved
ItemsNotFoundHow many of the items asked for by node id were not in the folder, so nothing was done to them. Each is also one record in OperationResult.Losses, and the result is then ErrorCode.CompletedWithLosses.
ItemsRequestedHow many items the caller asked for by node id (ItemOps.DeleteItems, ItemOps.MoveItems). Zero when the items were chosen by a predicate, which names no number.

Details

EditReport() constructor

VB.NET

Public Sub New()

C#

public EditReport();

AttachmentsRemoved property

VB.NET

Public Property AttachmentsRemoved As Integer

C#

public int AttachmentsRemoved { get; set; }

Property value

Int32

FoldersDeleted property

VB.NET

Public Property FoldersDeleted As Integer

C#

public int FoldersDeleted { get; set; }

Property value

Int32

FoldersMoved property

VB.NET

Public Property FoldersMoved As Integer

C#

public int FoldersMoved { get; set; }

Property value

Int32

FoldersReclassified property

VB.NET

Public Property FoldersReclassified As Integer

C#

public int FoldersReclassified { get; set; }

Property value

Int32

FoldersRenamed property

VB.NET

Public Property FoldersRenamed As Integer

C#

public int FoldersRenamed { get; set; }

Property value

Int32

ItemsDeleted property

VB.NET

Public Property ItemsDeleted As Integer

C#

public int ItemsDeleted { get; set; }

Property value

Int32

ItemsEdited property

VB.NET

Public Property ItemsEdited As Integer

C#

public int ItemsEdited { get; set; }

Property value

Int32

ItemsMoved property

VB.NET

Public Property ItemsMoved As Integer

C#

public int ItemsMoved { get; set; }

Property value

Int32

ItemsNotFound property

How many of the items asked for by node id were not in the folder, so nothing was done to them. Each is also one record in OperationResult.Losses, and the result is then ErrorCode.CompletedWithLosses.

VB.NET

Public Property ItemsNotFound As Integer

C#

public int ItemsNotFound { get; set; }

Property value

Int32

ItemsRequested property

How many items the caller asked for by node id (ItemOps.DeleteItems, ItemOps.MoveItems). Zero when the items were chosen by a predicate, which names no number.

VB.NET

Public Property ItemsRequested As Integer

C#

public int ItemsRequested { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

ItemEdit class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Property changes to apply to matching items (any field left Nothing is unchanged).

VB.NET

Public NotInheritable Class ItemEdit

C#

public sealed class ItemEdit

Constructors

NameDescription
ItemEdit()

Properties

NameDescription
BodyTextNew plain-text body, or Nothing to leave unchanged.
ImportanceNew importance (0 low, 1 normal, 2 high), or Nothing to leave unchanged.
SubjectNew subject (also updates the folder-list cache), or Nothing to leave unchanged.

Details

ItemEdit() constructor

VB.NET

Public Sub New()

C#

public ItemEdit();

BodyText property

New plain-text body, or Nothing to leave unchanged.

VB.NET

Public Property BodyText As String

C#

public string BodyText { get; set; }

Property value

String

Importance property

New importance (0 low, 1 normal, 2 high), or Nothing to leave unchanged.

VB.NET

Public Property Importance As Integer?

C#

public int? Importance { get; set; }

Property value

Nullable<Int32>

Subject property

New subject (also updates the folder-list cache), or Nothing to leave unchanged.

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

MergeLayout enumeration

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

How a merge lays out the sources in the output store.

VB.NET

Public Enum MergeLayout

C#

public enum MergeLayout

Members

NameValueDescription
Stacked0Each source becomes its own top-level folder tree under the destination root (the original behaviour) — every source keeps a separate Inbox/Calendar/etc.
Unified1Folders are blended by role/path: same-named folders across sources merge into one (one Inbox, one Calendar, …) carrying all sources' messages. A special folder is matched by its role before its name, so a source's wastebasket joins Deleted Items even when it is called Trash, Bin or Deleted Messages (likewise Sent Items, Calendar, Contacts, Tasks, Notes, Journal, Drafts, Outbox and Junk Email). Outlook's "(This computer only)" suffix on an IMAP account's local folders is dropped, so "Calendar (This computer only)" and "Calendar" become one.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

MergePreflight class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Scans merge sources for corruption before the merge begins, and repairs the ones the caller agrees to repair. See Scan.

VB.NET

Public NotInheritable Class MergePreflight

C#

public sealed class MergePreflight

Methods

NameDescription
Repair(PreflightReport, String, Func<SourceHealth, Int32, Int32, RepairChoice>, DiagnosticsContext) static

Repair the corrupt sources in scan, asking prompt what to do about each. "…ToAll" answers stop the asking, so an interactive host shows at most one dialog; pass a prompt that always returns RepairChoice.YesToAll for unattended use (or call ScanAndRepairAll).

NEVER throws, and never returns Nothing. The result is scan itself, updated. Its ErrorCode is ErrorCode.CompletedWithLosses when a repair failed (that source is still the damaged original) or a repaired copy is missing content; each file's SourceHealth.RepairErrorCode says which.

Scan(IList<String>, DiagnosticsContext) staticValidate every source and report which are damaged. Nothing is modified and nothing is repaired — this is the pass whose PreflightReport.CorruptCount feeds the single up-front prompt. NEVER throws (a licence or trial-limit refusal apart): check the report's ErrorCode, and PreflightReport.NotExaminedCount for files that could not be looked at.
ScanAndRepairAll(IList<String>, String, DiagnosticsContext) staticScan, then repair every corrupt source without asking — the non-interactive default (equivalent to answering "Yes to all"). Repaired copies are written into workDir; the originals are never modified.

Details

Repair(PreflightReport, String, Func<SourceHealth, Int32, Int32, RepairChoice>, DiagnosticsContext) method static

Repair the corrupt sources in scan, asking prompt what to do about each. "…ToAll" answers stop the asking, so an interactive host shows at most one dialog; pass a prompt that always returns RepairChoice.YesToAll for unattended use (or call ScanAndRepairAll).

NEVER throws, and never returns Nothing. The result is scan itself, updated. Its ErrorCode is ErrorCode.CompletedWithLosses when a repair failed (that source is still the damaged original) or a repaired copy is missing content; each file's SourceHealth.RepairErrorCode says which.

VB.NET

Public Shared Function Repair(
    scan As PreflightReport,
    workDir As String,
    Optional prompt As Func(Of SourceHealth, Integer, Integer, RepairChoice) = Nothing,
    Optional diag As DiagnosticsContext = Nothing
) As PreflightReport

C#

public static PreflightReport Repair(
    PreflightReport scan,
    string workDir,
    Func<SourceHealth, int, int, RepairChoice> prompt = null,
    DiagnosticsContext diag = null
);

Parameters

scan PreflightReport
workDir String
Where repaired copies are written. Created if missing. Nothing or empty: Settings.TempFolder.
prompt Func<SourceHealth, Int32, Int32, RepairChoice>
Called with the file, its 1-based position among the corrupt files, and how many there are. Nothing means "repair everything".
diag DiagnosticsContext

Returns

PreflightReport

Scan(IList<String>, DiagnosticsContext) method static

Validate every source and report which are damaged. Nothing is modified and nothing is repaired — this is the pass whose PreflightReport.CorruptCount feeds the single up-front prompt. NEVER throws (a licence or trial-limit refusal apart): check the report's ErrorCode, and PreflightReport.NotExaminedCount for files that could not be looked at.

VB.NET

Public Shared Function Scan(
    sourcePaths As IList(Of String),
    Optional diag As DiagnosticsContext = Nothing
) As PreflightReport

C#

public static PreflightReport Scan(IList<string> sourcePaths, DiagnosticsContext diag = null);

Parameters

sourcePaths IList<String>
diag DiagnosticsContext

Returns

PreflightReport

ScanAndRepairAll(IList<String>, String, DiagnosticsContext) method static

Scan, then repair every corrupt source without asking — the non-interactive default (equivalent to answering "Yes to all"). Repaired copies are written into workDir; the originals are never modified.

VB.NET

Public Shared Function ScanAndRepairAll(
    sourcePaths As IList(Of String),
    workDir As String,
    Optional diag As DiagnosticsContext = Nothing
) As PreflightReport

C#

public static PreflightReport ScanAndRepairAll(
    IList<string> sourcePaths,
    string workDir,
    DiagnosticsContext diag = null
);

Parameters

sourcePaths IList<String>
workDir String
diag DiagnosticsContext

Returns

PreflightReport

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

MergeReport class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Outcome of a merge. ErrorCode 0 = success; on failure ErrorDescription says why (ToString() renders "code: description").

VB.NET

Public NotInheritable Class MergeReport
    Inherits OperationResult

C#

public sealed class MergeReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
MergeReport()

Properties

NameDescription
BlankMessagesRemovedBlank mail removed (no subject, no body, no attachments) — dropBlankMessages.
DuplicatesRemoved
FilteredOutMessages dropped by the item-type filter (selective merge).
FoldersMerged
FoldersPrunedEmpty folders removed by the prune pass (pruneEmpty).
FoldersReclassifiedBase folders that kept a typed container class (IPF.Appointment, IPF.Contact, …) which a blended source carrying only the generic IPF.Note would otherwise have downgraded to a mail folder — which takes every typed item inside it out of the calendar, contacts and task views.
FoldersRehomedReal folders found outside the IPM subtree (parked under the store root, where Outlook never displays them) and re-homed under the IPM root so they are visible.
MessagesMergedHow many messages (items of every kind) the merged output holds.
MessagesRehomedMessages owned by the store root folder itself (invisible to Outlook) and re-homed into the IPM root's contents table.
SourcesSkippedSource files left out because they could not be opened or prepared. Only ever non-zero when RecoverFromCorruption is set; each is also listed in Losses.
TotalNodes
VerificationThe outcome of the check asked for with verify, or Nothing when it was not asked for or the merge did not get as far as writing its output.
WarningNon-fatal pre-flight advisory (e.g. low disk space) — Nothing when clean. Also listed, with every other warning, in Warnings.

Details

MergeReport() constructor

VB.NET

Public Sub New()

C#

public MergeReport();

BlankMessagesRemoved property

Blank mail removed (no subject, no body, no attachments) — dropBlankMessages.

VB.NET

Public Property BlankMessagesRemoved As Integer

C#

public int BlankMessagesRemoved { get; set; }

Property value

Int32

DuplicatesRemoved property

VB.NET

Public Property DuplicatesRemoved As Integer

C#

public int DuplicatesRemoved { get; set; }

Property value

Int32

FilteredOut property

Messages dropped by the item-type filter (selective merge).

VB.NET

Public Property FilteredOut As Integer

C#

public int FilteredOut { get; set; }

Property value

Int32

FoldersMerged property

VB.NET

Public Property FoldersMerged As Integer

C#

public int FoldersMerged { get; set; }

Property value

Int32

FoldersPruned property

Empty folders removed by the prune pass (pruneEmpty).

VB.NET

Public Property FoldersPruned As Integer

C#

public int FoldersPruned { get; set; }

Property value

Int32

FoldersReclassified property

Base folders that kept a typed container class (IPF.Appointment, IPF.Contact, …) which a blended source carrying only the generic IPF.Note would otherwise have downgraded to a mail folder — which takes every typed item inside it out of the calendar, contacts and task views.

VB.NET

Public Property FoldersReclassified As Integer

C#

public int FoldersReclassified { get; set; }

Property value

Int32

FoldersRehomed property

Real folders found outside the IPM subtree (parked under the store root, where Outlook never displays them) and re-homed under the IPM root so they are visible.

VB.NET

Public Property FoldersRehomed As Integer

C#

public int FoldersRehomed { get; set; }

Property value

Int32

MessagesMerged property

How many messages (items of every kind) the merged output holds.

VB.NET

Public Property MessagesMerged As Integer

C#

public int MessagesMerged { get; set; }

Property value

Int32

MessagesRehomed property

Messages owned by the store root folder itself (invisible to Outlook) and re-homed into the IPM root's contents table.

VB.NET

Public Property MessagesRehomed As Integer

C#

public int MessagesRehomed { get; set; }

Property value

Int32

SourcesSkipped property

Source files left out because they could not be opened or prepared. Only ever non-zero when RecoverFromCorruption is set; each is also listed in Losses.

VB.NET

Public Property SourcesSkipped As Integer

C#

public int SourcesSkipped { get; set; }

Property value

Int32

TotalNodes property

VB.NET

Public Property TotalNodes As Integer

C#

public int TotalNodes { get; set; }

Property value

Int32

Verification property

The outcome of the check asked for with verify, or Nothing when it was not asked for or the merge did not get as far as writing its output.

VB.NET

Public Property Verification As MergeVerification

C#

public MergeVerification Verification { get; set; }

Property value

MergeVerification

Warning property

Non-fatal pre-flight advisory (e.g. low disk space) — Nothing when clean. Also listed, with every other warning, in Warnings.

VB.NET

Public Property Warning As String

C#

public string Warning { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

MergeVerification class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

The outcome of checking a merge's output against its sources.

VB.NET

Public NotInheritable Class MergeVerification

C#

public sealed class MergeVerification

Constructors

NameDescription
MergeVerification()

Properties

NameDescription
DifferenceCountHow many differences were found, including any beyond those listed.
DifferencesEach difference in plain language, by source file and folder. At most the first 200.
ExpectedMessagesMessages the output should hold: the sources' messages less those removed on purpose.
MessagesInRenamedFoldersMessages that are present, but in a folder whose name differs from their source folder's. Expected in a unified merge, which blends special folders; not counted as a difference.
MissingMessagesSource messages with no counterpart in the output that the merge did not account for.
OutputMessagesMessages found in the output.
PassedTrue when the output holds what the sources held, less what the merge was asked to remove.
SourceMessagesMessages found in the sources.
UnexpectedMessagesOutput messages with no counterpart in any source.
UnopenableMessagesMessages the output lists but that could not be opened.

Methods

NameDescription
ToString()"61,204 source, 60,799 expected, 60,799 in output: passed".

Details

MergeVerification() constructor

VB.NET

Public Sub New()

C#

public MergeVerification();

DifferenceCount property

How many differences were found, including any beyond those listed.

VB.NET

Public Property DifferenceCount As Integer

C#

public int DifferenceCount { get; set; }

Property value

Int32

Differences property

Each difference in plain language, by source file and folder. At most the first 200.

VB.NET

Public ReadOnly Property Differences As IReadOnlyList(Of String)

C#

public IReadOnlyList<string> Differences { get; }

Property value

IReadOnlyList<String>

ExpectedMessages property

Messages the output should hold: the sources' messages less those removed on purpose.

VB.NET

Public Property ExpectedMessages As Long

C#

public long ExpectedMessages { get; set; }

Property value

Int64

MessagesInRenamedFolders property

Messages that are present, but in a folder whose name differs from their source folder's. Expected in a unified merge, which blends special folders; not counted as a difference.

VB.NET

Public Property MessagesInRenamedFolders As Long

C#

public long MessagesInRenamedFolders { get; set; }

Property value

Int64

MissingMessages property

Source messages with no counterpart in the output that the merge did not account for.

VB.NET

Public Property MissingMessages As Long

C#

public long MissingMessages { get; set; }

Property value

Int64

OutputMessages property

Messages found in the output.

VB.NET

Public Property OutputMessages As Long

C#

public long OutputMessages { get; set; }

Property value

Int64

Passed property

True when the output holds what the sources held, less what the merge was asked to remove.

VB.NET

Public ReadOnly Property Passed As Boolean

C#

public bool Passed { get; }

Property value

Boolean

SourceMessages property

Messages found in the sources.

VB.NET

Public Property SourceMessages As Long

C#

public long SourceMessages { get; set; }

Property value

Int64

UnexpectedMessages property

Output messages with no counterpart in any source.

VB.NET

Public Property UnexpectedMessages As Long

C#

public long UnexpectedMessages { get; set; }

Property value

Int64

UnopenableMessages property

Messages the output lists but that could not be opened.

VB.NET

Public Property UnopenableMessages As Long

C#

public long UnopenableMessages { get; set; }

Property value

Int64

ToString() method

"61,204 source, 60,799 expected, 60,799 in output: passed".

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

OrphanScanResult class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

What StoreMerger.OrphanScan found. ErrorCode 0 = every table was read.

VB.NET

Public NotInheritable Class OrphanScanResult
    Inherits OperationResult

C#

public sealed class OrphanScanResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
OrphanScanResult()

Properties

NameDescription
MsgNodesMessage nodes in the store.
OrphansMessage nodes no folder table lists, in ascending order. A message whose own folder's table could not be read is not included: nothing is known about it.
ReferencedDistinct messages some folder table lists.
TablesUnreadableTables that are present but could not be read. When non-zero the orphan list is incomplete, and ErrorCode is not 0.

Details

OrphanScanResult() constructor

VB.NET

Public Sub New()

C#

public OrphanScanResult();

MsgNodes property

Message nodes in the store.

VB.NET

Public Property MsgNodes As Integer

C#

public int MsgNodes { get; set; }

Property value

Int32

Orphans property

Message nodes no folder table lists, in ascending order. A message whose own folder's table could not be read is not included: nothing is known about it.

VB.NET

Public ReadOnly Property Orphans As List(Of UInteger)

C#

public List<uint> Orphans { get; }

Property value

List<UInt32>

Referenced property

Distinct messages some folder table lists.

VB.NET

Public Property Referenced As Integer

C#

public int Referenced { get; set; }

Property value

Int32

TablesUnreadable property

Tables that are present but could not be read. When non-zero the orphan list is incomplete, and ErrorCode is not 0.

VB.NET

Public Property TablesUnreadable As Integer

C#

public int TablesUnreadable { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

PasswordChangeReport class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Outcome of StorePassword.SetPassword / StorePassword.RemovePassword: what was written, the structural validation of the output, and the password state read back from the output as evidence.

VB.NET

Public NotInheritable Class PasswordChangeReport
    Inherits OperationResult

C#

public sealed class PasswordChangeReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
PasswordChangeReport()

Properties

NameDescription
HadPasswordWhether the source had a password before the change.
HasPasswordWhether the output has a password now (read back from the output file).
NodesWritten
OutputIsValidTrue when the output passes strict structural validation.
OutputPath
OutputReportStrict structural validation of the output.
PasswordCrcThe CRC value written (0 = removed).
SourcePath
SucceededTrue only when the change completed cleanly: ErrorCode 0 and a structurally valid output, with nothing lost. A change that wrote a usable file but had to leave damaged content out (recovery mode) is False here, with ErrorCode 15 (CompletedWithLosses) and OutputWritten True; test those to accept it. Any other code means the destination was not written or replaced.

Details

PasswordChangeReport() constructor

VB.NET

Public Sub New()

C#

public PasswordChangeReport();

HadPassword property

Whether the source had a password before the change.

VB.NET

Public Property HadPassword As Boolean

C#

public bool HadPassword { get; set; }

Property value

Boolean

HasPassword property

Whether the output has a password now (read back from the output file).

VB.NET

Public Property HasPassword As Boolean

C#

public bool HasPassword { get; set; }

Property value

Boolean

NodesWritten property

VB.NET

Public Property NodesWritten As Integer

C#

public int NodesWritten { get; set; }

Property value

Int32

OutputIsValid property

True when the output passes strict structural validation.

VB.NET

Public ReadOnly Property OutputIsValid As Boolean

C#

public bool OutputIsValid { get; }

Property value

Boolean

OutputPath property

VB.NET

Public Property OutputPath As String

C#

public string OutputPath { get; set; }

Property value

String

OutputReport property

Strict structural validation of the output.

VB.NET

Public Property OutputReport As ValidationReport

C#

public ValidationReport OutputReport { get; set; }

Property value

ValidationReport

PasswordCrc property

The CRC value written (0 = removed).

VB.NET

Public Property PasswordCrc As UInteger

C#

public uint PasswordCrc { get; set; }

Property value

UInt32

SourcePath property

VB.NET

Public Property SourcePath As String

C#

public string SourcePath { get; set; }

Property value

String

Succeeded property

True only when the change completed cleanly: ErrorCode 0 and a structurally valid output, with nothing lost. A change that wrote a usable file but had to leave damaged content out (recovery mode) is False here, with ErrorCode 15 (CompletedWithLosses) and OutputWritten True; test those to accept it. Any other code means the destination was not written or replaced.

VB.NET

Public Overrides ReadOnly Property Succeeded As Boolean

C#

public override bool Succeeded { get; }

Property value

Boolean

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

PasswordStatus class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Result of StorePassword.GetStatus: whether the file has an open password and the stored CRC value.

VB.NET

Public NotInheritable Class PasswordStatus
    Inherits OperationResult

C#

public sealed class PasswordStatus : OperationResult

Inherits: OperationResult

Constructors

NameDescription
PasswordStatus()

Properties

NameDescription
HasPasswordTrue when PidTagPstPassword is present and non-zero.
PasswordCrcThe stored CRC (0 = no password). Compare with StorePassword.ComputeCrc to verify a candidate password.
Path

Details

PasswordStatus() constructor

VB.NET

Public Sub New()

C#

public PasswordStatus();

HasPassword property

True when PidTagPstPassword is present and non-zero.

VB.NET

Public Property HasPassword As Boolean

C#

public bool HasPassword { get; set; }

Property value

Boolean

PasswordCrc property

The stored CRC (0 = no password). Compare with StorePassword.ComputeCrc to verify a candidate password.

VB.NET

Public Property PasswordCrc As UInteger

C#

public uint PasswordCrc { get; set; }

Property value

UInt32

Path property

VB.NET

Public Property Path As String

C#

public string Path { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

PreflightReport class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Outcome of a pre-merge scan (and repair, when one was run).

VB.NET

Public NotInheritable Class PreflightReport
    Inherits OperationResult

C#

public sealed class PreflightReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
PreflightReport()

Properties

NameDescription
CancelledTrue when the caller answered RepairChoice.Cancel. The merge must not proceed.
CorruptCountHow many sources are damaged and repairable. This is the number to put in the single prompt: "Found {CorruptCount} corrupted PST files. Do you want to attempt repair(s)?"
EffectiveSourcesThe list to hand to the merger: repaired copies substituted for the originals they replace, unsupported formats still present (the merge's own recovery path reports them).
FilesEvery source, in the order supplied.
LargePageOstCountHow many sources are Outlook 2013+ OSTs (the 4K container). They read and merge normally; they are counted separately only to record that no structural check was run on them, and so they are never mistaken for damage.
LegacyAnsiCountHow many sources are legacy ANSI stores, sound or not. A damaged one is counted here AND in CorruptCount. The merge converts every one of them to Unicode.
NotExaminedCountHow many sources could not be examined (missing, locked, access denied, or the check failed). They are not counted as corrupted and not offered for repair; each one's SourceHealth.NotExaminedCode says why. A merge given such a file will fail on it, or in recovery mode leave it out, so deal with these before merging.
RepairedCountHow many sources were successfully repaired.
RepairFailedCountHow many repairs were attempted and failed.
UnsupportedCount

How many sources are a format we do not read at all. These are not damaged and are not offered for repair — they simply cannot take part in the merge.

Outlook 2013+ OSTs are NOT counted here: they are read and merged. See LargePageOstCount.

Methods

NameDescription
Describe()One line per problem file, fit to show a user.

Details

PreflightReport() constructor

VB.NET

Public Sub New()

C#

public PreflightReport();

Cancelled property

True when the caller answered RepairChoice.Cancel. The merge must not proceed.

VB.NET

Public Property Cancelled As Boolean

C#

public bool Cancelled { get; set; }

Property value

Boolean

CorruptCount property

How many sources are damaged and repairable. This is the number to put in the single prompt: "Found {CorruptCount} corrupted PST files. Do you want to attempt repair(s)?"

VB.NET

Public ReadOnly Property CorruptCount As Integer

C#

public int CorruptCount { get; }

Property value

Int32

EffectiveSources property

The list to hand to the merger: repaired copies substituted for the originals they replace, unsupported formats still present (the merge's own recovery path reports them).

VB.NET

Public ReadOnly Property EffectiveSources As IList(Of String)

C#

public IList<string> EffectiveSources { get; }

Property value

IList<String>

Files property

Every source, in the order supplied.

VB.NET

Public ReadOnly Property Files As IList(Of SourceHealth)

C#

public IList<SourceHealth> Files { get; }

Property value

IList<SourceHealth>

LargePageOstCount property

How many sources are Outlook 2013+ OSTs (the 4K container). They read and merge normally; they are counted separately only to record that no structural check was run on them, and so they are never mistaken for damage.

VB.NET

Public ReadOnly Property LargePageOstCount As Integer

C#

public int LargePageOstCount { get; }

Property value

Int32

LegacyAnsiCount property

How many sources are legacy ANSI stores, sound or not. A damaged one is counted here AND in CorruptCount. The merge converts every one of them to Unicode.

VB.NET

Public ReadOnly Property LegacyAnsiCount As Integer

C#

public int LegacyAnsiCount { get; }

Property value

Int32

NotExaminedCount property

How many sources could not be examined (missing, locked, access denied, or the check failed). They are not counted as corrupted and not offered for repair; each one's SourceHealth.NotExaminedCode says why. A merge given such a file will fail on it, or in recovery mode leave it out, so deal with these before merging.

VB.NET

Public ReadOnly Property NotExaminedCount As Integer

C#

public int NotExaminedCount { get; }

Property value

Int32

RepairedCount property

How many sources were successfully repaired.

VB.NET

Public ReadOnly Property RepairedCount As Integer

C#

public int RepairedCount { get; }

Property value

Int32

RepairFailedCount property

How many repairs were attempted and failed.

VB.NET

Public ReadOnly Property RepairFailedCount As Integer

C#

public int RepairFailedCount { get; }

Property value

Int32

UnsupportedCount property

How many sources are a format we do not read at all. These are not damaged and are not offered for repair — they simply cannot take part in the merge.

Outlook 2013+ OSTs are NOT counted here: they are read and merged. See LargePageOstCount.

VB.NET

Public ReadOnly Property UnsupportedCount As Integer

C#

public int UnsupportedCount { get; }

Property value

Int32

Describe() method

One line per problem file, fit to show a user.

VB.NET

Public Function Describe() As String

C#

public string Describe();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

RepairChoice enumeration

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

What the caller wants done about one corrupt source. The "…ToAll" answers apply to every remaining corrupt file so the user is not asked again; Cancel abandons the whole operation.

VB.NET

Public Enum RepairChoice

C#

public enum RepairChoice

Members

NameValueDescription
Yes0Repair this file; ask again for the next one.
YesToAll1Repair this file and every remaining corrupt file without asking again.
No2Leave this file as it is; ask again for the next one.
NoToAll3Leave every remaining corrupt file as it is, without asking again.
Cancel4Abandon the whole operation — nothing further is scanned, repaired or merged.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

SourceHealth class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

One source file's pre-merge verdict.

VB.NET

Public NotInheritable Class SourceHealth

C#

public sealed class SourceHealth

Properties

NameDescription
EffectivePathThe path a merge should actually consume: the repaired copy when there is one, otherwise the original.
ErrorCountStructural errors the validator found.
IsCorruptedTrue when the file was examined and has structural errors. A file that could not be examined at all is not "corrupted": see NotExamined.
IsLargePageOst

True when the file is an Outlook 2013+ OST (wVer 36), the "4K" container. It is READ NORMALLY and merges like any other source; it is flagged only because the structural validator understands the 512-byte page and this container is 4096-byte, so no structural check was run on it.

This replaces an earlier classification of these files as an unsupported format that the user should "export to .pst from Outlook". That was the superseded verdict from before the 4K reader existed: the reader was taught the container and this preflight was not, so a store the library opens perfectly was reported as corrupt. Never mark this container corrupt or unsupported again — see docs/ost-2013-reader-scope.md.

IsLegacyAnsi

True when the file is a legacy ANSI store (wVer 14/15). This says what the file IS, not whether it is sound: an ANSI store is validated like any other (since 2026-11-11) and IsCorrupted carries the verdict. A sound one merges normally, and the merge writes its content out as Unicode, as it does for every source.

Before that date the validator could not check this container, so every ANSI source was passed as "sound" unexamined, and a damaged one reached the merge unannounced.

A damaged ANSI source is offered for repair like any other. The repaired copy is a Unicode PST; the original is never modified.

IsUnsupportedFormat

True when the file is a format this library does not read at all. Such a file is NOT damaged and repairing it cannot work, so it is reported separately and never offered for repair.

An Outlook 2013+ OST is NOT one of these — it is read normally. See IsLargePageOst.

MessagesIncompleteMessages the repair recovered without part of their content (usually the body).
MessagesLostMessages the repair could not recover: they are not in the repaired copy.
NotExamined

True when the file could not be examined: it is missing, locked by another program (commonly Outlook), access to it was denied, or the check itself failed. Nothing is known about its contents, so it is neither clean nor corrupted, and it is never offered for repair. NotExaminedCode says why and Summary says it in words.

Until 2026-11-11 such a file was reported as corrupted and offered for repair, so a PST that was merely open in Outlook was shown to the user as damaged.

NotExaminedCodeWhy the file could not be examined (ErrorCode.FileNotFound, ErrorCode.FileLocked, ErrorCode.AccessDenied, …); ErrorCode.Ok when it was examined.
PathThe source file as supplied.
RepairAttemptedTrue once a repair was attempted for this file.
RepairedPathThe repaired copy, when one was written. The original is never modified.
RepairErrorCodeThe repair's own result code: ErrorCode.Ok, or ErrorCode.CompletedWithLosses when the repaired copy was written but some content could not be recovered, or the reason the repair failed.
RepairSucceededTrue when the repair produced a usable file.
SummaryOne line fit to show a user.
SupportReportPathWhere the support report was written, when one was.

Details

EffectivePath property

The path a merge should actually consume: the repaired copy when there is one, otherwise the original.

VB.NET

Public ReadOnly Property EffectivePath As String

C#

public string EffectivePath { get; }

Property value

String

ErrorCount property

Structural errors the validator found.

VB.NET

Public Property ErrorCount As Integer

C#

public int ErrorCount { get; set; }

Property value

Int32

IsCorrupted property

True when the file was examined and has structural errors. A file that could not be examined at all is not "corrupted": see NotExamined.

VB.NET

Public Property IsCorrupted As Boolean

C#

public bool IsCorrupted { get; set; }

Property value

Boolean

IsLargePageOst property

True when the file is an Outlook 2013+ OST (wVer 36), the "4K" container. It is READ NORMALLY and merges like any other source; it is flagged only because the structural validator understands the 512-byte page and this container is 4096-byte, so no structural check was run on it.

This replaces an earlier classification of these files as an unsupported format that the user should "export to .pst from Outlook". That was the superseded verdict from before the 4K reader existed: the reader was taught the container and this preflight was not, so a store the library opens perfectly was reported as corrupt. Never mark this container corrupt or unsupported again — see docs/ost-2013-reader-scope.md.

VB.NET

Public Property IsLargePageOst As Boolean

C#

public bool IsLargePageOst { get; set; }

Property value

Boolean

IsLegacyAnsi property

True when the file is a legacy ANSI store (wVer 14/15). This says what the file IS, not whether it is sound: an ANSI store is validated like any other (since 2026-11-11) and IsCorrupted carries the verdict. A sound one merges normally, and the merge writes its content out as Unicode, as it does for every source.

Before that date the validator could not check this container, so every ANSI source was passed as "sound" unexamined, and a damaged one reached the merge unannounced.

A damaged ANSI source is offered for repair like any other. The repaired copy is a Unicode PST; the original is never modified.

VB.NET

Public Property IsLegacyAnsi As Boolean

C#

public bool IsLegacyAnsi { get; set; }

Property value

Boolean

IsUnsupportedFormat property

True when the file is a format this library does not read at all. Such a file is NOT damaged and repairing it cannot work, so it is reported separately and never offered for repair.

An Outlook 2013+ OST is NOT one of these — it is read normally. See IsLargePageOst.

VB.NET

Public Property IsUnsupportedFormat As Boolean

C#

public bool IsUnsupportedFormat { get; set; }

Property value

Boolean

MessagesIncomplete property

Messages the repair recovered without part of their content (usually the body).

VB.NET

Public Property MessagesIncomplete As Integer

C#

public int MessagesIncomplete { get; set; }

Property value

Int32

MessagesLost property

Messages the repair could not recover: they are not in the repaired copy.

VB.NET

Public Property MessagesLost As Integer

C#

public int MessagesLost { get; set; }

Property value

Int32

NotExamined property

True when the file could not be examined: it is missing, locked by another program (commonly Outlook), access to it was denied, or the check itself failed. Nothing is known about its contents, so it is neither clean nor corrupted, and it is never offered for repair. NotExaminedCode says why and Summary says it in words.

Until 2026-11-11 such a file was reported as corrupted and offered for repair, so a PST that was merely open in Outlook was shown to the user as damaged.

VB.NET

Public Property NotExamined As Boolean

C#

public bool NotExamined { get; set; }

Property value

Boolean

NotExaminedCode property

Why the file could not be examined (ErrorCode.FileNotFound, ErrorCode.FileLocked, ErrorCode.AccessDenied, …); ErrorCode.Ok when it was examined.

VB.NET

Public Property NotExaminedCode As ErrorCode

C#

public ErrorCode NotExaminedCode { get; set; }

Property value

ErrorCode

Path property

The source file as supplied.

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

RepairAttempted property

True once a repair was attempted for this file.

VB.NET

Public Property RepairAttempted As Boolean

C#

public bool RepairAttempted { get; set; }

Property value

Boolean

RepairedPath property

The repaired copy, when one was written. The original is never modified.

VB.NET

Public Property RepairedPath As String

C#

public string RepairedPath { get; set; }

Property value

String

RepairErrorCode property

The repair's own result code: ErrorCode.Ok, or ErrorCode.CompletedWithLosses when the repaired copy was written but some content could not be recovered, or the reason the repair failed.

VB.NET

Public Property RepairErrorCode As ErrorCode

C#

public ErrorCode RepairErrorCode { get; set; }

Property value

ErrorCode

RepairSucceeded property

True when the repair produced a usable file.

VB.NET

Public Property RepairSucceeded As Boolean

C#

public bool RepairSucceeded { get; set; }

Property value

Boolean

Summary property

One line fit to show a user.

VB.NET

Public Property Summary As String

C#

public string Summary { get; set; }

Property value

String

SupportReportPath property

Where the support report was written, when one was.

VB.NET

Public Property SupportReportPath As String

C#

public string SupportReportPath { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

SplitPart class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class SplitPart

C#

public sealed class SplitPart

Constructors

NameDescription
SplitPart()

Properties

NameDescription
MessageCountMessages written to this part. Counted as they were written, not as planned: in recovery mode a message that could not be read is left out, and is in MessagesLost instead.
MessagesLostMessages assigned to this part that could not be read and were left out of it (recovery mode only; otherwise an unreadable message fails the split). Each is listed in the report's OperationResult.Losses.
Path
SizeBytes

Details

SplitPart() constructor

VB.NET

Public Sub New()

C#

public SplitPart();

MessageCount property

Messages written to this part. Counted as they were written, not as planned: in recovery mode a message that could not be read is left out, and is in MessagesLost instead.

VB.NET

Public Property MessageCount As Integer

C#

public int MessageCount { get; set; }

Property value

Int32

MessagesLost property

Messages assigned to this part that could not be read and were left out of it (recovery mode only; otherwise an unreadable message fails the split). Each is listed in the report's OperationResult.Losses.

VB.NET

Public Property MessagesLost As Integer

C#

public int MessagesLost { get; set; }

Property value

Int32

Path property

VB.NET

Public Property Path As String

C#

public string Path { get; set; }

Property value

String

SizeBytes property

VB.NET

Public Property SizeBytes As Long

C#

public long SizeBytes { get; set; }

Property value

Int64

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

SplitReport class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Outcome of a split. ErrorCode 0 = success. Parts lists the files that exist when the call returns: on any failure or cancellation the parts are removed again and the list is empty.

VB.NET

Public NotInheritable Class SplitReport
    Inherits OperationResult

C#

public sealed class SplitReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
SplitReport()

Properties

NameDescription
Parts
TotalMessages

Details

SplitReport() constructor

VB.NET

Public Sub New()

C#

public SplitReport();

Parts property

VB.NET

Public ReadOnly Property Parts As List(Of SplitPart)

C#

public List<SplitPart> Parts { get; }

Property value

List<SplitPart>

TotalMessages property

VB.NET

Public Property TotalMessages As Integer

C#

public int TotalMessages { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

StoreConverter class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class StoreConverter

C#

public sealed class StoreConverter

Methods

NameDescription
ConvertToUnicode(String, String) staticConvert a PST/OST (ANSI or Unicode) into a fresh Unicode PST at outPath. ANSI stores are upgraded to Unicode (escaping the 2 GB limit); Table Contexts are rebuilt at Unicode geometry so other clients read them. NEVER throws: check the result's ErrorCode (0 = success).
ConvertToUnicode(String, String, DiagnosticsContext, Boolean) staticConvert with diagnostics. Emits Started/ReadProgress/WriteProgress/Completed and, when diag.RecoverFromCorruption is set, skips unreadable nodes. When SkipDuplicates is set the conversion runs through the dedup pass so duplicate messages — and their table rows and folder counts — are dropped cleanly. NEVER throws: check the result's ErrorCode (0 = success; e.g. DestinationExists when overwrite wasn't requested).

Details

ConvertToUnicode(String, String) method static

Convert a PST/OST (ANSI or Unicode) into a fresh Unicode PST at outPath. ANSI stores are upgraded to Unicode (escaping the 2 GB limit); Table Contexts are rebuilt at Unicode geometry so other clients read them. NEVER throws: check the result's ErrorCode (0 = success).

VB.NET

Public Shared Function ConvertToUnicode(sourcePath As String, outPath As String) As GenericResult

C#

public static GenericResult ConvertToUnicode(string sourcePath, string outPath);

Parameters

sourcePath String
outPath String

Returns

GenericResult

ConvertToUnicode(String, String, DiagnosticsContext, Boolean) method static

Convert with diagnostics. Emits Started/ReadProgress/WriteProgress/Completed and, when diag.RecoverFromCorruption is set, skips unreadable nodes. When SkipDuplicates is set the conversion runs through the dedup pass so duplicate messages — and their table rows and folder counts — are dropped cleanly. NEVER throws: check the result's ErrorCode (0 = success; e.g. DestinationExists when overwrite wasn't requested).

VB.NET

Public Shared Function ConvertToUnicode(
    sourcePath As String,
    outPath As String,
    diag As DiagnosticsContext,
    Optional overwrite As Boolean = False
) As GenericResult

C#

public static GenericResult ConvertToUnicode(
    string sourcePath,
    string outPath,
    DiagnosticsContext diag,
    bool overwrite = false
);

Parameters

sourcePath String
outPath String
diag DiagnosticsContext
overwrite Boolean

Returns

GenericResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

StoreMerger class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class StoreMerger

C#

public sealed class StoreMerger

Properties

NameDescription
DropSearchFolders staticWhen True (default) merges drop search/view folders (non-IPM root children). Set False (CLI --keep-search) to carry them verbatim.
MaxNodeIdsPerVolume staticMax cumulative source node-id span packed into one output volume (MergeToVolumes) before rolling to a new volume. 0 = default (85% of the 27-bit nidIndex ceiling). Lower it in tests to force multi-volume source splitting without needing hundreds of real sources.
MergeWorkers staticMax concurrent source-conversion workers for the parallel merge.
ParallelMerge staticWhen True (default) a plain merge (no dedup/type-filter/volume edits) converts its sources on parallel worker threads, drained in source order. Set False to force the single-threaded pipeline (diagnostic / byte-equivalence A-B).

Methods

NameDescription
Merge(IList<String>, String, Dedup, HashSet<ItemKind>, DiagnosticsContext, Boolean, Func<Int32, Dictionary<UInt32, HashSet<UInt32>>>, Int64, MergeLayout, String, Boolean, Boolean, Boolean) static

Merge sourcePaths into a new Unicode PST at outPath. dedup removes duplicate messages. rootName sets the store display name Outlook shows for the mounted PST (default: "Stacked Merge" / "Unified Merge" by layout). NEVER throws: the returned report's ErrorCode is 0 on success, otherwise a failure class with ErrorDescription (report.ToString() = "code: description").

Content that cannot be read fails the merge and nothing is written, unless diag.RecoverFromCorruption is set: then it is left out, listed in the report's Losses, and the code is ErrorCode.CompletedWithLosses.

MergeToVolumes(IList<String>, String, Int64, Dedup, HashSet<ItemKind>, DiagnosticsContext, Boolean, String, Boolean, Boolean, MergeLayout, Boolean) staticMerge sourcePaths into one or more Unicode PST volumes capped at capBytes of message data each: outBasePath (archive.pst), then archive-002.pst, archive-003.pst … Each volume is a standalone PST carrying the full folder structure with its share of the messages. Whole sources go into each volume in the order given, and a volume is planned against about 85% of capBytes so the file's own structure fits inside the cap; a single source too big for one volume is split by message. With more than one volume each store root is named "rootName (volume N)". Duplicates are found once, in a pre-scan over the whole set, under the same rule as Dedup (by destination folder unless Dedup.AcrossFolders is set), so a duplicate is removed even when its other copy falls in a different volume. Memory stays bounded (the scan holds per-message metadata; each volume streams).
OrphanScan(String) staticMessage nodes present in the NBT but referenced by NO contents/assoc table row — invisible to Outlook and to every row-based gate (count, conservation, inventory), yet still occupying the store. Rows and nodes are dropped by SEPARATE mechanisms, so a bug can remove one and not the other: a rewrite that drops a message's table ROW must drop its NODE too. Read-only; computed from a single NBT pass.
SweepPlan(String) staticWhat a post-merge sweep would actually change, computed READ-ONLY. A sweep is a whole-store rewrite (10–22GB for a real archive), so discovering "nothing to do" by writing the file and then deleting it is the expensive way to learn it. Plan first; rewrite only when a count is non-zero.

Details

DropSearchFolders property static

When True (default) merges drop search/view folders (non-IPM root children). Set False (CLI --keep-search) to carry them verbatim.

VB.NET

Public Shared Property DropSearchFolders As Boolean

C#

public static bool DropSearchFolders { get; set; }

Property value

Boolean

MaxNodeIdsPerVolume property static

Max cumulative source node-id span packed into one output volume (MergeToVolumes) before rolling to a new volume. 0 = default (85% of the 27-bit nidIndex ceiling). Lower it in tests to force multi-volume source splitting without needing hundreds of real sources.

VB.NET

Public Shared Property MaxNodeIdsPerVolume As ULong

C#

public static ulong MaxNodeIdsPerVolume { get; set; }

Property value

UInt64

MergeWorkers property static

Max concurrent source-conversion workers for the parallel merge.

VB.NET

Public Shared Property MergeWorkers As Integer

C#

public static int MergeWorkers { get; set; }

Property value

Int32

ParallelMerge property static

When True (default) a plain merge (no dedup/type-filter/volume edits) converts its sources on parallel worker threads, drained in source order. Set False to force the single-threaded pipeline (diagnostic / byte-equivalence A-B).

VB.NET

Public Shared Property ParallelMerge As Boolean

C#

public static bool ParallelMerge { get; set; }

Property value

Boolean

Merge(IList<String>, String, Dedup, HashSet<ItemKind>, DiagnosticsContext, Boolean, Func<Int32, Dictionary<UInt32, HashSet<UInt32>>>, Int64, MergeLayout, String, Boolean, Boolean, Boolean) method static

Merge sourcePaths into a new Unicode PST at outPath. dedup removes duplicate messages. rootName sets the store display name Outlook shows for the mounted PST (default: "Stacked Merge" / "Unified Merge" by layout). NEVER throws: the returned report's ErrorCode is 0 on success, otherwise a failure class with ErrorDescription (report.ToString() = "code: description").

Content that cannot be read fails the merge and nothing is written, unless diag.RecoverFromCorruption is set: then it is left out, listed in the report's Losses, and the code is ErrorCode.CompletedWithLosses.

VB.NET

Public Shared Function Merge(
    sourcePaths As IList(Of String),
    outPath As String,
    Optional dedup As Dedup = Nothing,
    Optional keepKinds As HashSet(Of ItemKind) = Nothing,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional extraDrops As Func(Of Integer, Dictionary(Of UInteger, HashSet(Of UInteger))) = Nothing,
    Optional maxBytes As Long = 0,
    Optional layout As MergeLayout = MergeLayout.Stacked,
    Optional rootName As String = Nothing,
    Optional pruneEmpty As Boolean = False,
    Optional dropBlankMessages As Boolean = True,
    Optional verify As Boolean = False
) As MergeReport

C#

public static MergeReport Merge(
    IList<string> sourcePaths,
    string outPath,
    Dedup dedup = null,
    HashSet<ItemKind> keepKinds = null,
    DiagnosticsContext diag = null,
    bool overwrite = false,
    Func<int, Dictionary<uint, HashSet<uint>>> extraDrops = null,
    long maxBytes = 0,
    MergeLayout layout = MergeLayout.Stacked,
    string rootName = null,
    bool pruneEmpty = false,
    bool dropBlankMessages = true,
    bool verify = false
);

Parameters

sourcePaths IList<String>
outPath String
dedup Dedup
keepKinds HashSet<ItemKind>
diag DiagnosticsContext
overwrite Boolean
extraDrops Func<Int32, Dictionary<UInt32, HashSet<UInt32>>>
maxBytes Int64
layout MergeLayout
rootName String
pruneEmpty Boolean
dropBlankMessages Boolean
verify Boolean
When True, the output is checked against the sources. Every source's folders and messages are mapped before the merge starts; afterwards the output is read back, every message it lists is opened, and each folder's messages are compared with what the sources held, less what the merge was asked to remove (duplicates, blank messages, kinds not wanted). The outcome is in the report's Verification; if anything is missing, extra or miscounted the code is ErrorCode.VerificationFailed and the output is still there to inspect. It costs one extra read of every source and one of the output.

Returns

MergeReport

MergeToVolumes(IList<String>, String, Int64, Dedup, HashSet<ItemKind>, DiagnosticsContext, Boolean, String, Boolean, Boolean, MergeLayout, Boolean) method static

Merge sourcePaths into one or more Unicode PST volumes capped at capBytes of message data each: outBasePath (archive.pst), then archive-002.pst, archive-003.pst … Each volume is a standalone PST carrying the full folder structure with its share of the messages. Whole sources go into each volume in the order given, and a volume is planned against about 85% of capBytes so the file's own structure fits inside the cap; a single source too big for one volume is split by message. With more than one volume each store root is named "rootName (volume N)". Duplicates are found once, in a pre-scan over the whole set, under the same rule as Dedup (by destination folder unless Dedup.AcrossFolders is set), so a duplicate is removed even when its other copy falls in a different volume. Memory stays bounded (the scan holds per-message metadata; each volume streams).

VB.NET

Public Shared Function MergeToVolumes(
    sourcePaths As IList(Of String),
    outBasePath As String,
    capBytes As Long,
    Optional dedup As Dedup = Nothing,
    Optional keepKinds As HashSet(Of ItemKind) = Nothing,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional rootName As String = Nothing,
    Optional dropBlankMessages As Boolean = True,
    Optional pruneEmpty As Boolean = False,
    Optional layout As MergeLayout = MergeLayout.Stacked,
    Optional verify As Boolean = False
) As VolumeReport

C#

public static VolumeReport MergeToVolumes(
    IList<string> sourcePaths,
    string outBasePath,
    long capBytes,
    Dedup dedup = null,
    HashSet<ItemKind> keepKinds = null,
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string rootName = null,
    bool dropBlankMessages = true,
    bool pruneEmpty = false,
    MergeLayout layout = MergeLayout.Stacked,
    bool verify = false
);

Parameters

sourcePaths IList<String>
outBasePath String
capBytes Int64
dedup Dedup
keepKinds HashSet<ItemKind>
diag DiagnosticsContext
overwrite Boolean
rootName String
dropBlankMessages Boolean
pruneEmpty Boolean
layout MergeLayout
Stacked gives every source its own named section within each volume; Unified blends same-named folders inside each volume. Volumes partition by contiguous SOURCE range either way, so a unified volume is a standalone unified store over its own slice of the sources — the same folder name can therefore appear in more than one volume, holding different mail. That is inherent to splitting and is true of stacked sections too.
verify Boolean
When True, the volumes are checked against the sources. Every source's folders and messages are mapped before the merge starts; afterwards every volume is read back, every message it lists is opened, and the set as a whole is compared with what the sources held, less what the merge was asked to remove (duplicates, blank messages, kinds not wanted, messages too large for a volume). The outcome is in the report's Verification; if anything is missing, extra or miscounted the code is ErrorCode.VerificationFailed and the volumes are still there to inspect. It costs one extra read of every source and one of every volume.

Returns

VolumeReport

Remarks

NEVER throws. Content that cannot be read fails the merge, unless diag.RecoverFromCorruption is set: then it is left out, listed in the report's Losses, and the code is ErrorCode.CompletedWithLosses. If the merge fails or is cancelled part-way, the volumes it had already written are deleted: a partial set must not be mistaken for the whole.

OrphanScan(String) method static

Message nodes present in the NBT but referenced by NO contents/assoc table row — invisible to Outlook and to every row-based gate (count, conservation, inventory), yet still occupying the store. Rows and nodes are dropped by SEPARATE mechanisms, so a bug can remove one and not the other: a rewrite that drops a message's table ROW must drop its NODE too. Read-only; computed from a single NBT pass.

VB.NET

Public Shared Function OrphanScan(path As String) As OrphanScanResult

C#

public static OrphanScanResult OrphanScan(string path);

Parameters

path String

Returns

OrphanScanResult

Remarks

NEVER throws: check the result's ErrorCode. A table that cannot be read is counted in TablesUnreadable and makes the code ErrorCode.CompletedWithLosses. The messages that table's folder owns are then NOT reported as orphans: nothing is known about them either way.

SweepPlan(String) method static

What a post-merge sweep would actually change, computed READ-ONLY. A sweep is a whole-store rewrite (10–22GB for a real archive), so discovering "nothing to do" by writing the file and then deleting it is the expensive way to learn it. Plan first; rewrite only when a count is non-zero.

VB.NET

Public Shared Function SweepPlan(path As String) As SweepPlanResult

C#

public static SweepPlanResult SweepPlan(string path);

Parameters

path String

Returns

SweepPlanResult

Remarks

NEVER throws: check the result's ErrorCode. A folder table that cannot be read is counted in TablesUnreadable and makes the code ErrorCode.CompletedWithLosses: the figures then cover only what could be read (such a folder is never counted as prunable), so do not act on them as a clean bill.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

StorePassword class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Read, set or remove the password of a PST file. A PST password is a stored CRC hash, not encryption — it controls Outlook's open prompt only; the data itself is never encrypted by it. SetPassword/RemovePassword write a new file (atomic, validated): pass the same path as source and output with overwrite:=True to change in place.

VB.NET

Public NotInheritable Class StorePassword

C#

public sealed class StorePassword

Methods

NameDescription
ComputeCrc(String) staticThe CRC Outlook stores and compares for password — the [MS-PST] 5.3 CRC of the password's ANSI (Windows-1252) bytes. Empty/Nothing returns 0 (= no password). Exposed so hosts can verify a user-supplied password against PasswordStatus.PasswordCrc before opening.
GetStatus(String) staticReport whether path has an open password set (PidTagPstPassword present and non-zero), without throwing.
RemovePassword(String, String, DiagnosticsContext, Boolean) staticWrite a copy of srcPath to outPath with the open password cleared, so the file opens without a prompt. Same guarantees and in-place convention as SetPassword.
SetPassword(String, String, String, DiagnosticsContext, Boolean) staticWrite a copy of srcPath to outPath with the open password set to password. Only the message store PC is rebuilt — every other node is preserved byte-for-byte (an ANSI source is upgraded to Unicode, as everywhere else in the library). The output is written atomically and structurally validated; the new CRC is read back from the output as proof. To change the password of a file in place, pass the same path for both arguments with overwrite:=True.

Details

ComputeCrc(String) method static

The CRC Outlook stores and compares for password — the [MS-PST] 5.3 CRC of the password's ANSI (Windows-1252) bytes. Empty/Nothing returns 0 (= no password). Exposed so hosts can verify a user-supplied password against PasswordStatus.PasswordCrc before opening.

VB.NET

Public Shared Function ComputeCrc(password As String) As UInteger

C#

public static uint ComputeCrc(string password);

Parameters

password String

Returns

UInt32

GetStatus(String) method static

Report whether path has an open password set (PidTagPstPassword present and non-zero), without throwing.

VB.NET

Public Shared Function GetStatus(path As String) As PasswordStatus

C#

public static PasswordStatus GetStatus(string path);

Parameters

path String

Returns

PasswordStatus

RemovePassword(String, String, DiagnosticsContext, Boolean) method static

Write a copy of srcPath to outPath with the open password cleared, so the file opens without a prompt. Same guarantees and in-place convention as SetPassword.

VB.NET

Public Shared Function RemovePassword(
    srcPath As String,
    outPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False
) As PasswordChangeReport

C#

public static PasswordChangeReport RemovePassword(
    string srcPath,
    string outPath,
    DiagnosticsContext diag = null,
    bool overwrite = false
);

Parameters

srcPath String
outPath String
diag DiagnosticsContext
overwrite Boolean

Returns

PasswordChangeReport

SetPassword(String, String, String, DiagnosticsContext, Boolean) method static

Write a copy of srcPath to outPath with the open password set to password. Only the message store PC is rebuilt — every other node is preserved byte-for-byte (an ANSI source is upgraded to Unicode, as everywhere else in the library). The output is written atomically and structurally validated; the new CRC is read back from the output as proof. To change the password of a file in place, pass the same path for both arguments with overwrite:=True.

VB.NET

Public Shared Function SetPassword(
    srcPath As String,
    outPath As String,
    password As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False
) As PasswordChangeReport

C#

public static PasswordChangeReport SetPassword(
    string srcPath,
    string outPath,
    string password,
    DiagnosticsContext diag = null,
    bool overwrite = false
);

Parameters

srcPath String
outPath String
password String
diag DiagnosticsContext
overwrite Boolean

Returns

PasswordChangeReport

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

StoreSplitter class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class StoreSplitter

C#

public sealed class StoreSplitter

Methods

NameDescription
SplitByPredicate(String, String, String, Func<PstMessage, Boolean>, DiagnosticsContext, Boolean) staticSplit into two stores: messages that satisfy predicate go to matchPath, the rest to restPath. The predicate receives each PstMessage. NEVER throws: check the report's ErrorCode (0 = success). An exception thrown by the predicate itself stops the split and is reported as its error.
SplitBySize(String, String, Int64, DiagnosticsContext, Boolean) staticSplit sourcePath into parts of at most maxBytes of message data each, written as <name>-001.pst, -002.pst, … in outDir. NEVER throws: check the report's ErrorCode (0 = success).

Details

SplitByPredicate(String, String, String, Func<PstMessage, Boolean>, DiagnosticsContext, Boolean) method static

Split into two stores: messages that satisfy predicate go to matchPath, the rest to restPath. The predicate receives each PstMessage. NEVER throws: check the report's ErrorCode (0 = success). An exception thrown by the predicate itself stops the split and is reported as its error.

VB.NET

Public Shared Function SplitByPredicate(
    sourcePath As String,
    matchPath As String,
    restPath As String,
    predicate As Func(Of PstMessage, Boolean),
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False
) As SplitReport

C#

public static SplitReport SplitByPredicate(
    string sourcePath,
    string matchPath,
    string restPath,
    Func<PstMessage, bool> predicate,
    DiagnosticsContext diag = null,
    bool overwrite = false
);

Parameters

sourcePath String
matchPath String
restPath String
predicate Func<PstMessage, Boolean>
diag DiagnosticsContext
overwrite Boolean
False (the default): if either file already exists the split is refused with ErrorCode.DestinationExists before anything is read or written.

Returns

SplitReport

SplitBySize(String, String, Int64, DiagnosticsContext, Boolean) method static

Split sourcePath into parts of at most maxBytes of message data each, written as <name>-001.pst, -002.pst, … in outDir. NEVER throws: check the report's ErrorCode (0 = success).

VB.NET

Public Shared Function SplitBySize(
    sourcePath As String,
    outDir As String,
    maxBytes As Long,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False
) As SplitReport

C#

public static SplitReport SplitBySize(
    string sourcePath,
    string outDir,
    long maxBytes,
    DiagnosticsContext diag = null,
    bool overwrite = false
);

Parameters

sourcePath String
outDir String
maxBytes Int64
diag DiagnosticsContext
overwrite Boolean
False (the default): if any part's file already exists the split is refused with ErrorCode.DestinationExists before anything is written.

Returns

SplitReport

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

SweepPlanResult class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

What StoreMerger.SweepPlan found a sweep would change. ErrorCode 0 = every folder table was read.

VB.NET

Public NotInheritable Class SweepPlanResult
    Inherits OperationResult

C#

public sealed class SweepPlanResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
SweepPlanResult()

Properties

NameDescription
DuplicatesDuplicate messages a dedup sweep would remove.
ParkedFoldersReal folders outside the IPM subtree that a sweep would re-home.
PrunableFoldersEmpty folders a prune sweep would remove.
RootOwnedMessagesMessages owned by the store root itself that a sweep would re-home.
TablesUnreadableFolder tables that are present but could not be read. When non-zero the other figures cover only what could be read, and ErrorCode is not 0.

Details

SweepPlanResult() constructor

VB.NET

Public Sub New()

C#

public SweepPlanResult();

Duplicates property

Duplicate messages a dedup sweep would remove.

VB.NET

Public Property Duplicates As Integer

C#

public int Duplicates { get; set; }

Property value

Int32

ParkedFolders property

Real folders outside the IPM subtree that a sweep would re-home.

VB.NET

Public Property ParkedFolders As Integer

C#

public int ParkedFolders { get; set; }

Property value

Int32

PrunableFolders property

Empty folders a prune sweep would remove.

VB.NET

Public Property PrunableFolders As Integer

C#

public int PrunableFolders { get; set; }

Property value

Int32

RootOwnedMessages property

Messages owned by the store root itself that a sweep would re-home.

VB.NET

Public Property RootOwnedMessages As Integer

C#

public int RootOwnedMessages { get; set; }

Property value

Int32

TablesUnreadable property

Folder tables that are present but could not be read. When non-zero the other figures cover only what could be read, and ErrorCode is not 0.

VB.NET

Public Property TablesUnreadable As Integer

C#

public int TablesUnreadable { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

VolumeInfo class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

One output volume produced by a capped merge.

VB.NET

Public NotInheritable Class VolumeInfo

C#

public sealed class VolumeInfo

Constructors

NameDescription
VolumeInfo()

Properties

NameDescription
MessagesMessages the volume holds, counted from the file after it was written.
Path
SizeBytes

Details

VolumeInfo() constructor

VB.NET

Public Sub New()

C#

public VolumeInfo();

Messages property

Messages the volume holds, counted from the file after it was written.

VB.NET

Public Property Messages As Integer

C#

public int Messages { get; set; }

Property value

Int32

Path property

VB.NET

Public Property Path As String

C#

public string Path { get; set; }

Property value

String

SizeBytes property

VB.NET

Public Property SizeBytes As Long

C#

public long SizeBytes { get; set; }

Property value

Int64

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace

VolumeReport class

Namespace: Bastion.Pst.Convert · Assembly: Bastion.Pst.dll

Outcome of a capped (volume-split) merge. ErrorCode 0 = success.

VB.NET

Public NotInheritable Class VolumeReport
    Inherits OperationResult

C#

public sealed class VolumeReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
VolumeReport()

Properties

NameDescription
BlankMessagesRemovedBlank mail removed (no subject, no body, no attachments).
DuplicatesRemoved
FilteredOutMessages left out by the item-type filter (keepKinds).
FoldersRehomedReal folders found outside a source's IPM subtree and re-homed under it.
MessagesRehomedMessages owned by a source's store root and re-homed into its IPM root.
MessagesSkippedOversizeMessages left out because one message alone is larger than the volume cap. Each is listed in Losses, and the result's code is then ErrorCode.CompletedWithLosses, not Ok. Raise the cap to include them.
SourcesSkippedSource files left out because they could not be opened or prepared. Only ever non-zero when RecoverFromCorruption is set; each is also listed in Losses.
TotalMessages
VerificationThe outcome of the check asked for with verify, or Nothing when it was not asked for or the merge did not get as far as writing its volumes.
Volumes
WarningNon-fatal advisories (e.g. low disk space), joined — Nothing when clean. Each is also listed separately in Warnings.

Details

VolumeReport() constructor

VB.NET

Public Sub New()

C#

public VolumeReport();

BlankMessagesRemoved property

Blank mail removed (no subject, no body, no attachments).

VB.NET

Public Property BlankMessagesRemoved As Integer

C#

public int BlankMessagesRemoved { get; set; }

Property value

Int32

DuplicatesRemoved property

VB.NET

Public Property DuplicatesRemoved As Integer

C#

public int DuplicatesRemoved { get; set; }

Property value

Int32

FilteredOut property

Messages left out by the item-type filter (keepKinds).

VB.NET

Public Property FilteredOut As Integer

C#

public int FilteredOut { get; set; }

Property value

Int32

FoldersRehomed property

Real folders found outside a source's IPM subtree and re-homed under it.

VB.NET

Public Property FoldersRehomed As Integer

C#

public int FoldersRehomed { get; set; }

Property value

Int32

MessagesRehomed property

Messages owned by a source's store root and re-homed into its IPM root.

VB.NET

Public Property MessagesRehomed As Integer

C#

public int MessagesRehomed { get; set; }

Property value

Int32

MessagesSkippedOversize property

Messages left out because one message alone is larger than the volume cap. Each is listed in Losses, and the result's code is then ErrorCode.CompletedWithLosses, not Ok. Raise the cap to include them.

VB.NET

Public Property MessagesSkippedOversize As Integer

C#

public int MessagesSkippedOversize { get; set; }

Property value

Int32

SourcesSkipped property

Source files left out because they could not be opened or prepared. Only ever non-zero when RecoverFromCorruption is set; each is also listed in Losses.

VB.NET

Public Property SourcesSkipped As Integer

C#

public int SourcesSkipped { get; set; }

Property value

Int32

TotalMessages property

VB.NET

Public Property TotalMessages As Integer

C#

public int TotalMessages { get; set; }

Property value

Int32

Verification property

The outcome of the check asked for with verify, or Nothing when it was not asked for or the merge did not get as far as writing its volumes.

VB.NET

Public Property Verification As MergeVerification

C#

public MergeVerification Verification { get; set; }

Property value

MergeVerification

Volumes property

VB.NET

Public ReadOnly Property Volumes As List(Of VolumeInfo)

C#

public List<VolumeInfo> Volumes { get; }

Property value

List<VolumeInfo>

Warning property

Non-fatal advisories (e.g. low disk space), joined — Nothing when clean. Each is also listed separately in Warnings.

VB.NET

Public Property Warning As String

C#

public string Warning { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Diagnostics namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
ActivityEventArgsPayload for DiagnosticsContext.Activity: one line of plain-language narrative, already fit to show a user, and when it happened.
AnsiUpgradeEventArgsPayload for DiagnosticsContext.AnsiUpgradeRequired: the ANSI source about to be upgraded to Unicode. Set Proceed to make the hard choice — True upgrades to Unicode (unopenable in Outlook 2002 and earlier), False aborts with the source PST untouched.
CorruptionEventArgsPayload for DiagnosticsContext.SourceCorruptionDetected: which file, how bad, and (when auto-generated) where the developer support report was written.
DiagEventArgsPayload for DiagnosticsContext.Started / DiagnosticsContext.Completed.
DiagnosticsContextOpt-in diagnostics surface for read/export operations: switches plus public events the host application can subscribe to. Pass an instance into Merge/Split/ConvertToUnicode.
ErrorEventArgsPayload for DiagnosticsContext.ErrorOccurred: the failing phase, the error type and message, the item that failed, and whether the run recovered (skipped and continued).
ItemRemovedEventArgsPayload for DiagnosticsContext.ItemRemoved: one message a merge discarded, and everything needed to identify it afterwards. A merge that removes duplicates or blank messages is deleting the customer's mail, so "we removed 383,115 items" is a claim rather than evidence; this is the evidence, one event per item.
ModeEventArgsPayload for DiagnosticsContext.ModeChosen: which mode an input was processed in.
ProgressEventArgsPayload for DiagnosticsContext.ReadProgress / DiagnosticsContext.WriteProgress.

Enumerations

NameDescription
DiagPhaseWhich side of an operation an event refers to.
ProcessingModeHow a single input store is processed.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

ActivityEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.Activity: one line of plain-language narrative, already fit to show a user, and when it happened.

VB.NET

Public NotInheritable Class ActivityEventArgs
    Inherits EventArgs

C#

public sealed class ActivityEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
Line
TimestampUtc

Details

Line property

VB.NET

Public ReadOnly Property Line As String

C#

public string Line { get; }

Property value

String

TimestampUtc property

VB.NET

Public ReadOnly Property TimestampUtc As Date

C#

public DateTime TimestampUtc { get; }

Property value

DateTime

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

AnsiUpgradeEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.AnsiUpgradeRequired: the ANSI source about to be upgraded to Unicode. Set Proceed to make the hard choice — True upgrades to Unicode (unopenable in Outlook 2002 and earlier), False aborts with the source PST untouched.

VB.NET

Public NotInheritable Class AnsiUpgradeEventArgs
    Inherits EventArgs

C#

public sealed class AnsiUpgradeEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
ProceedThe decision: True to upgrade to Unicode, False (default) to abort without writing.
SourcePathThe legacy ANSI PST that the operation would rewrite as Unicode.

Details

Proceed property

The decision: True to upgrade to Unicode, False (default) to abort without writing.

VB.NET

Public Property Proceed As Boolean

C#

public bool Proceed { get; set; }

Property value

Boolean

SourcePath property

The legacy ANSI PST that the operation would rewrite as Unicode.

VB.NET

Public ReadOnly Property SourcePath As String

C#

public string SourcePath { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

CorruptionEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.SourceCorruptionDetected: which file, how bad, and (when auto-generated) where the developer support report was written.

VB.NET

Public NotInheritable Class CorruptionEventArgs
    Inherits EventArgs

C#

public sealed class CorruptionEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
ErrorCountStructural error count the scan found.
Path
SummarySample of issue descriptions (offset + reason), enough for a log line.
SupportReportPathPath of the auto-generated support report, or Nothing.

Details

ErrorCount property

Structural error count the scan found.

VB.NET

Public ReadOnly Property ErrorCount As Integer

C#

public int ErrorCount { get; }

Property value

Int32

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Summary property

Sample of issue descriptions (offset + reason), enough for a log line.

VB.NET

Public ReadOnly Property Summary As String

C#

public string Summary { get; }

Property value

String

SupportReportPath property

Path of the auto-generated support report, or Nothing.

VB.NET

Public ReadOnly Property SupportReportPath As String

C#

public string SupportReportPath { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

DiagEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.Started / DiagnosticsContext.Completed.

VB.NET

Public NotInheritable Class DiagEventArgs
    Inherits EventArgs

C#

public sealed class DiagEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
Message
Operation
TimestampUtc

Details

Message property

VB.NET

Public ReadOnly Property Message As String

C#

public string Message { get; }

Property value

String

Operation property

VB.NET

Public ReadOnly Property Operation As String

C#

public string Operation { get; }

Property value

String

TimestampUtc property

VB.NET

Public ReadOnly Property TimestampUtc As Date

C#

public DateTime TimestampUtc { get; }

Property value

DateTime

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

DiagnosticsContext class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Opt-in diagnostics surface for read/export operations: switches plus public events the host application can subscribe to. Pass an instance into Merge/Split/ConvertToUnicode.

VB.NET

Public NotInheritable Class DiagnosticsContext

C#

public sealed class DiagnosticsContext

Constructors

NameDescription
DiagnosticsContext()

Properties

NameDescription
AllowAnsiToUnicodeUpgradeExplicit, up-front authorisation to rewrite a legacy ANSI PST as Unicode when adding to / editing it. Default False: such an operation is REFUSED (returns ErrorCode.AnsiUpgradeRequired, source untouched) unless this is set True or an AnsiUpgradeRequired handler proceeds. Guards ANSI-only-Outlook users against a silent format upgrade that would make the file unopenable in their Outlook.
AuditRemovalsAsk for a per-item audit trail of everything a merge removes (see ItemRemoved). Off by default. Turning it on trades memory for the ability to say exactly which messages were discarded and why.
AutoSupportReportWhen true and corruption is detected, a support report (structural metadata only — never message content) is written automatically; its path rides on the SourceCorruptionDetected event and in the user log.
CancellationTokenCooperative cancellation for long operations (merge/split/convert/import). Pass a token from your CancellationTokenSource; when you cancel it, the operation stops at the next checkpoint and returns ErrorCode.OperationCancelled. The atomic-write model means nothing partial is left behind — the destination file is untouched.
CorruptionDetectedTrue once any scanned source (or a repair's source validation) reported corruption.
CreateUserLogWhen true, the library writes a plain-language activity log a NON-developer can read — what was read, what was merged, how many duplicates were removed, whether corruption was found and what was done about it. One line per milestone, no jargon, no offsets. Path in UserLogPath (default: BastionPstSdk-UserLog-….txt in the user's temp folder).
EnableLoggingWhen true, every raised event is also written, in detail, to LogFilePath.
InMemoryThresholdBytesIn Auto mode, inputs at or below this size are buffered in memory; larger inputs stream. Default 256 MB. (Streaming is safe at any size, so this is only a small-input optimisation.)
LogFilePathPath of the diagnostics log. If left blank when logging is first used, it defaults to %TEMP%\BastionPstSdk-yyyyMMdd-HHmmss-fff.log.
MaxOutputBytes

Hard ceiling on the size of a store an IMPORT writes. 0 (default) means unlimited, which is the historical behaviour. When set, the write aborts before the output could exceed it and the operation returns ErrorCode.OutputSizeExceeded with the source untouched — it can never silently produce an over-limit PST.

Why this exists: importing is a whole-store rewrite, and unlike a merge it has no volume splitting to fall back on (that lives in StoreMerger.MergeToVolumes). Importing into a store that is already large therefore grew it without limit. Measured 2026-08-19: 4.1 GB of mail imported into a 45.8 GB volume produced 50.0 GB, and every structural check — infracheck, sendercheck, advertised-vs-enumerated and full validation — passed on it, because an oversized store is otherwise perfectly well formed.

Outlook's own ceiling is about 50 GB, so a useful setting is somewhat below it: 49152 MB (48 GB) is what this product's merge paths cap at. Leave margin — Outlook writes its own search and view infrastructure into any store it opens (~78 MB measured on a 50 GB file), so a store that just fits when written can be pushed past the limit by the client merely opening it.

MessagesReadHow many messages were read from the source files, and how many were written to the output. The pair is the honest headline for a merge: "we read 511,066 messages and wrote 186,857" says what happened in a way "items merged" never did — that count only ever described the unified blend, and read as zero on every stacked merge. MessagesWritten is counted where each node is emitted, so it is right for both layouts and excludes the dry-run passes (those converters carry no diagnostics). MessagesRead is DERIVED from it - written plus everything removed - because a unified merge enumerates a source more than once and counting reads at the converter double-counts them. Associated messages — Outlook's hidden housekeeping items — are not counted: they are not the customer's mail.
MessagesWrittenMessages written to the output. See MessagesRead.
ProcessingModeProcessing mode. Auto (default) decides per input from its size; force InMemory or Streaming to override. Streaming has bounded memory for any size; the two produce identical output.
RecoverFromCorruptionWhen true, a read or write error on a single item is logged and reported via ErrorOccurred (Recovered=True) and the operation continues, exporting whatever it can recover, instead of aborting.
ScanSourcesOnOpenWhen true, every source store is structurally scanned as an operation opens it (full page/block validation — thorough but adds read time). A corrupt source raises SourceCorruptionDetected, latches CorruptionDetected, and — when AutoSupportReport is set — writes a support report for the developer.
SkipDuplicatesWhen true, duplicate email is not written, by the same check as passing a Dedup: a copy of a message already written to the SAME destination folder (matched by Internet Message-ID, else by subject, sender name and delivery time) is left out. Copies filed in different folders are all kept; only Dedup.AcrossFolders on a Dedup changes that. Contacts, appointments and other non-mail items are always kept.
SupportContactWhere the end user should send support reports — embedded in the report and the user-log guidance line. Defaults to Bastion Software Solutions Ltd's support address; set your own to route reports to your application's support instead.
SupportReportDirectoryDirectory for auto-generated support reports (default: the user's temp folder).
UserLogLinesEverything written to the user log so far — hosts can show it in a UI instead of (or as well as) the file.
UserLogPathPath of the user log. If blank when the first line is written, defaults to %TEMP%\BastionPstSdk-UserLog-yyyyMMdd-HHmmss.txt.

Methods

NameDescription
ReportStep(Int64, Int64, String)Report progress for a step the HOST is doing — reading a set of files before an operation, verifying afterwards — through the same channel the library uses, so one dialog can show the whole job.

Events

NameDescription
ActivityOne line of plain-language narrative as the operation proceeds — the same lines the user log records, raised as they happen so a host can show a running activity list. A long merge is otherwise a caption and a bar that both sit still for minutes at a time, which reads as a hung application. This is what a host puts in the list under the bars. Raised whether or not CreateUserLog is set, and a handler that throws is swallowed: reporting on an operation must never be able to abort it.
AnsiUpgradeRequiredRaised the first time an add/edit operation finds its target is a legacy ANSI PST and would upgrade it to Unicode. A handler MUST make a hard choice by setting AnsiUpgradeEventArgs.Proceed: True to upgrade to Unicode (the file will no longer open in Outlook 2002 and earlier), or leave it False to abort with the source PST untouched. With no handler, AllowAnsiToUnicodeUpgrade decides (default: abort).
CompletedRaised once when an operation finishes (after the output file is written).
ErrorOccurredRaised when a read or write step fails; includes the error type and reason.
ItemRemovedRaised once for every message a merge removes — each duplicate and each blank — naming the item, the folder it came from and, for a duplicate, the copy that survives. Recording costs memory (the surviving copy of every key must be remembered), so it is off unless AuditRemovals is set. Subscribing alone is not enough: a host that wants the audit must ask for it, because a large merge removes hundreds of thousands of items and the caller should choose to pay for that. A handler that throws is swallowed, on the same rule as the other diagnostic events: reporting on an operation must never be able to abort it.
ModeChosenRaised once per input store with the processing mode chosen for it (and its size).
ReadProgressRaised as the source store is read/converted, item by item.
SourceCorruptionDetectedRaised when a scanned source is corrupt. SupportReportPath is Nothing unless AutoSupportReport generated one.
SourceProgressCoarse per-source (or per-volume) progress: fired once as each input store is scanned or each output volume is written, so a long multi-store merge is not silent between Started and Completed. ProgressEventArgs.Processed/ProgressEventArgs.Total carry the store index and count; CurrentItem carries a short label.
StartedRaised once when an operation begins its read pass.
WriteProgressRaised as nodes are written to the output PST, item by item.

Details

DiagnosticsContext() constructor

VB.NET

Public Sub New()

C#

public DiagnosticsContext();

AllowAnsiToUnicodeUpgrade property

Explicit, up-front authorisation to rewrite a legacy ANSI PST as Unicode when adding to / editing it. Default False: such an operation is REFUSED (returns ErrorCode.AnsiUpgradeRequired, source untouched) unless this is set True or an AnsiUpgradeRequired handler proceeds. Guards ANSI-only-Outlook users against a silent format upgrade that would make the file unopenable in their Outlook.

VB.NET

Public Property AllowAnsiToUnicodeUpgrade As Boolean

C#

public bool AllowAnsiToUnicodeUpgrade { get; set; }

Property value

Boolean

AuditRemovals property

Ask for a per-item audit trail of everything a merge removes (see ItemRemoved). Off by default. Turning it on trades memory for the ability to say exactly which messages were discarded and why.

VB.NET

Public Property AuditRemovals As Boolean

C#

public bool AuditRemovals { get; set; }

Property value

Boolean

AutoSupportReport property

When true and corruption is detected, a support report (structural metadata only — never message content) is written automatically; its path rides on the SourceCorruptionDetected event and in the user log.

VB.NET

Public Property AutoSupportReport As Boolean

C#

public bool AutoSupportReport { get; set; }

Property value

Boolean

CancellationToken property

Cooperative cancellation for long operations (merge/split/convert/import). Pass a token from your CancellationTokenSource; when you cancel it, the operation stops at the next checkpoint and returns ErrorCode.OperationCancelled. The atomic-write model means nothing partial is left behind — the destination file is untouched.

VB.NET

Public Property CancellationToken As CancellationToken

C#

public CancellationToken CancellationToken { get; set; }

Property value

CancellationToken

CorruptionDetected property

True once any scanned source (or a repair's source validation) reported corruption.

VB.NET

Public ReadOnly Property CorruptionDetected As Boolean

C#

public bool CorruptionDetected { get; }

Property value

Boolean

CreateUserLog property

When true, the library writes a plain-language activity log a NON-developer can read — what was read, what was merged, how many duplicates were removed, whether corruption was found and what was done about it. One line per milestone, no jargon, no offsets. Path in UserLogPath (default: BastionPstSdk-UserLog-….txt in the user's temp folder).

VB.NET

Public Property CreateUserLog As Boolean

C#

public bool CreateUserLog { get; set; }

Property value

Boolean

EnableLogging property

When true, every raised event is also written, in detail, to LogFilePath.

VB.NET

Public Property EnableLogging As Boolean

C#

public bool EnableLogging { get; set; }

Property value

Boolean

InMemoryThresholdBytes property

In Auto mode, inputs at or below this size are buffered in memory; larger inputs stream. Default 256 MB. (Streaming is safe at any size, so this is only a small-input optimisation.)

VB.NET

Public Property InMemoryThresholdBytes As Long

C#

public long InMemoryThresholdBytes { get; set; }

Property value

Int64

LogFilePath property

Path of the diagnostics log. If left blank when logging is first used, it defaults to %TEMP%\BastionPstSdk-yyyyMMdd-HHmmss-fff.log.

VB.NET

Public Property LogFilePath As String

C#

public string LogFilePath { get; set; }

Property value

String

MaxOutputBytes property

Hard ceiling on the size of a store an IMPORT writes. 0 (default) means unlimited, which is the historical behaviour. When set, the write aborts before the output could exceed it and the operation returns ErrorCode.OutputSizeExceeded with the source untouched — it can never silently produce an over-limit PST.

Why this exists: importing is a whole-store rewrite, and unlike a merge it has no volume splitting to fall back on (that lives in StoreMerger.MergeToVolumes). Importing into a store that is already large therefore grew it without limit. Measured 2026-08-19: 4.1 GB of mail imported into a 45.8 GB volume produced 50.0 GB, and every structural check — infracheck, sendercheck, advertised-vs-enumerated and full validation — passed on it, because an oversized store is otherwise perfectly well formed.

Outlook's own ceiling is about 50 GB, so a useful setting is somewhat below it: 49152 MB (48 GB) is what this product's merge paths cap at. Leave margin — Outlook writes its own search and view infrastructure into any store it opens (~78 MB measured on a 50 GB file), so a store that just fits when written can be pushed past the limit by the client merely opening it.

VB.NET

Public Property MaxOutputBytes As Long

C#

public long MaxOutputBytes { get; set; }

Property value

Int64

MessagesRead property

How many messages were read from the source files, and how many were written to the output. The pair is the honest headline for a merge: "we read 511,066 messages and wrote 186,857" says what happened in a way "items merged" never did — that count only ever described the unified blend, and read as zero on every stacked merge. MessagesWritten is counted where each node is emitted, so it is right for both layouts and excludes the dry-run passes (those converters carry no diagnostics). MessagesRead is DERIVED from it - written plus everything removed - because a unified merge enumerates a source more than once and counting reads at the converter double-counts them. Associated messages — Outlook's hidden housekeeping items — are not counted: they are not the customer's mail.

VB.NET

Public ReadOnly Property MessagesRead As Long

C#

public long MessagesRead { get; }

Property value

Int64

MessagesWritten property

Messages written to the output. See MessagesRead.

VB.NET

Public ReadOnly Property MessagesWritten As Long

C#

public long MessagesWritten { get; }

Property value

Int64

ProcessingMode property

Processing mode. Auto (default) decides per input from its size; force InMemory or Streaming to override. Streaming has bounded memory for any size; the two produce identical output.

VB.NET

Public Property ProcessingMode As ProcessingMode

C#

public ProcessingMode ProcessingMode { get; set; }

Property value

ProcessingMode

RecoverFromCorruption property

When true, a read or write error on a single item is logged and reported via ErrorOccurred (Recovered=True) and the operation continues, exporting whatever it can recover, instead of aborting.

VB.NET

Public Property RecoverFromCorruption As Boolean

C#

public bool RecoverFromCorruption { get; set; }

Property value

Boolean

ScanSourcesOnOpen property

When true, every source store is structurally scanned as an operation opens it (full page/block validation — thorough but adds read time). A corrupt source raises SourceCorruptionDetected, latches CorruptionDetected, and — when AutoSupportReport is set — writes a support report for the developer.

VB.NET

Public Property ScanSourcesOnOpen As Boolean

C#

public bool ScanSourcesOnOpen { get; set; }

Property value

Boolean

SkipDuplicates property

When true, duplicate email is not written, by the same check as passing a Dedup: a copy of a message already written to the SAME destination folder (matched by Internet Message-ID, else by subject, sender name and delivery time) is left out. Copies filed in different folders are all kept; only Dedup.AcrossFolders on a Dedup changes that. Contacts, appointments and other non-mail items are always kept.

VB.NET

Public Property SkipDuplicates As Boolean

C#

public bool SkipDuplicates { get; set; }

Property value

Boolean

SupportContact property

Where the end user should send support reports — embedded in the report and the user-log guidance line. Defaults to Bastion Software Solutions Ltd's support address; set your own to route reports to your application's support instead.

VB.NET

Public Property SupportContact As String

C#

public string SupportContact { get; set; }

Property value

String

SupportReportDirectory property

Directory for auto-generated support reports (default: the user's temp folder).

VB.NET

Public Property SupportReportDirectory As String

C#

public string SupportReportDirectory { get; set; }

Property value

String

UserLogLines property

Everything written to the user log so far — hosts can show it in a UI instead of (or as well as) the file.

VB.NET

Public ReadOnly Property UserLogLines As IReadOnlyList(Of String)

C#

public IReadOnlyList<string> UserLogLines { get; }

Property value

IReadOnlyList<String>

UserLogPath property

Path of the user log. If blank when the first line is written, defaults to %TEMP%\BastionPstSdk-UserLog-yyyyMMdd-HHmmss.txt.

VB.NET

Public Property UserLogPath As String

C#

public string UserLogPath { get; set; }

Property value

String

ReportStep(Int64, Int64, String) method

Report progress for a step the HOST is doing — reading a set of files before an operation, verifying afterwards — through the same channel the library uses, so one dialog can show the whole job.

VB.NET

Public Sub ReportStep(processed As Long, total As Long, item As String)

C#

public void ReportStep(long processed, long total, string item);

Parameters

processed Int64
Items done so far.
total Int64
Items in total, or -1 when not known in advance.
item String
Short label for what is being processed now.

Remarks

Without this a host has to leave its own long steps unreported, because SourceProgress can only be raised from inside the library. A caller that opens seventeen stores to take a baseline before merging them is doing minutes of work the user can see no sign of, which reads as a hang exactly as a silent merge does.

Activity event

One line of plain-language narrative as the operation proceeds — the same lines the user log records, raised as they happen so a host can show a running activity list. A long merge is otherwise a caption and a bar that both sit still for minutes at a time, which reads as a hung application. This is what a host puts in the list under the bars. Raised whether or not CreateUserLog is set, and a handler that throws is swallowed: reporting on an operation must never be able to abort it.

VB.NET

Public Event Activity As EventHandler(Of ActivityEventArgs)

C#

public event EventHandler<ActivityEventArgs> Activity;

Event type

EventHandler<ActivityEventArgs>

AnsiUpgradeRequired event

Raised the first time an add/edit operation finds its target is a legacy ANSI PST and would upgrade it to Unicode. A handler MUST make a hard choice by setting AnsiUpgradeEventArgs.Proceed: True to upgrade to Unicode (the file will no longer open in Outlook 2002 and earlier), or leave it False to abort with the source PST untouched. With no handler, AllowAnsiToUnicodeUpgrade decides (default: abort).

VB.NET

Public Event AnsiUpgradeRequired As EventHandler(Of AnsiUpgradeEventArgs)

C#

public event EventHandler<AnsiUpgradeEventArgs> AnsiUpgradeRequired;

Event type

EventHandler<AnsiUpgradeEventArgs>

Completed event

Raised once when an operation finishes (after the output file is written).

VB.NET

Public Event Completed As EventHandler(Of DiagEventArgs)

C#

public event EventHandler<DiagEventArgs> Completed;

Event type

EventHandler<DiagEventArgs>

ErrorOccurred event

Raised when a read or write step fails; includes the error type and reason.

VB.NET

Public Event ErrorOccurred As EventHandler(Of ErrorEventArgs)

C#

public event EventHandler<ErrorEventArgs> ErrorOccurred;

Event type

EventHandler<ErrorEventArgs>

ItemRemoved event

Raised once for every message a merge removes — each duplicate and each blank — naming the item, the folder it came from and, for a duplicate, the copy that survives. Recording costs memory (the surviving copy of every key must be remembered), so it is off unless AuditRemovals is set. Subscribing alone is not enough: a host that wants the audit must ask for it, because a large merge removes hundreds of thousands of items and the caller should choose to pay for that. A handler that throws is swallowed, on the same rule as the other diagnostic events: reporting on an operation must never be able to abort it.

VB.NET

Public Event ItemRemoved As EventHandler(Of ItemRemovedEventArgs)

C#

public event EventHandler<ItemRemovedEventArgs> ItemRemoved;

Event type

EventHandler<ItemRemovedEventArgs>

ModeChosen event

Raised once per input store with the processing mode chosen for it (and its size).

VB.NET

Public Event ModeChosen As EventHandler(Of ModeEventArgs)

C#

public event EventHandler<ModeEventArgs> ModeChosen;

Event type

EventHandler<ModeEventArgs>

ReadProgress event

Raised as the source store is read/converted, item by item.

VB.NET

Public Event ReadProgress As EventHandler(Of ProgressEventArgs)

C#

public event EventHandler<ProgressEventArgs> ReadProgress;

Event type

EventHandler<ProgressEventArgs>

SourceCorruptionDetected event

Raised when a scanned source is corrupt. SupportReportPath is Nothing unless AutoSupportReport generated one.

VB.NET

Public Event SourceCorruptionDetected As EventHandler(Of CorruptionEventArgs)

C#

public event EventHandler<CorruptionEventArgs> SourceCorruptionDetected;

Event type

EventHandler<CorruptionEventArgs>

SourceProgress event

Coarse per-source (or per-volume) progress: fired once as each input store is scanned or each output volume is written, so a long multi-store merge is not silent between Started and Completed. ProgressEventArgs.Processed/ProgressEventArgs.Total carry the store index and count; CurrentItem carries a short label.

VB.NET

Public Event SourceProgress As EventHandler(Of ProgressEventArgs)

C#

public event EventHandler<ProgressEventArgs> SourceProgress;

Event type

EventHandler<ProgressEventArgs>

Started event

Raised once when an operation begins its read pass.

VB.NET

Public Event Started As EventHandler(Of DiagEventArgs)

C#

public event EventHandler<DiagEventArgs> Started;

Event type

EventHandler<DiagEventArgs>

WriteProgress event

Raised as nodes are written to the output PST, item by item.

VB.NET

Public Event WriteProgress As EventHandler(Of ProgressEventArgs)

C#

public event EventHandler<ProgressEventArgs> WriteProgress;

Event type

EventHandler<ProgressEventArgs>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

DiagPhase enumeration

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Which side of an operation an event refers to.

VB.NET

Public Enum DiagPhase

C#

public enum DiagPhase

Members

NameValueDescription
Read0
Write1

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

ErrorEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.ErrorOccurred: the failing phase, the error type and message, the item that failed, and whether the run recovered (skipped and continued).

VB.NET

Public NotInheritable Class ErrorEventArgs
    Inherits EventArgs

C#

public sealed class ErrorEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
ContextWhat was being processed (e.g. a node NID or source path).
ErrorThe underlying exception (may be Nothing).
ErrorTypeThe exception type name, e.g. "EndOfStreamException".
Message
Phase
RecoveredTrue when the operation skipped the failing item and carried on (RecoverFromCorruption); False when the error aborts the operation.
TimestampUtc

Details

Context property

What was being processed (e.g. a node NID or source path).

VB.NET

Public ReadOnly Property Context As String

C#

public string Context { get; }

Property value

String

Error property

The underlying exception (may be Nothing).

VB.NET

Public ReadOnly Property Error As Exception

C#

public Exception Error { get; }

Property value

Exception

ErrorType property

The exception type name, e.g. "EndOfStreamException".

VB.NET

Public ReadOnly Property ErrorType As String

C#

public string ErrorType { get; }

Property value

String

Message property

VB.NET

Public ReadOnly Property Message As String

C#

public string Message { get; }

Property value

String

Phase property

VB.NET

Public ReadOnly Property Phase As DiagPhase

C#

public DiagPhase Phase { get; }

Property value

DiagPhase

Recovered property

True when the operation skipped the failing item and carried on (RecoverFromCorruption); False when the error aborts the operation.

VB.NET

Public ReadOnly Property Recovered As Boolean

C#

public bool Recovered { get; }

Property value

Boolean

TimestampUtc property

VB.NET

Public ReadOnly Property TimestampUtc As Date

C#

public DateTime TimestampUtc { get; }

Property value

DateTime

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

ItemRemovedEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.ItemRemoved: one message a merge discarded, and everything needed to identify it afterwards. A merge that removes duplicates or blank messages is deleting the customer's mail, so "we removed 383,115 items" is a claim rather than evidence; this is the evidence, one event per item.

VB.NET

Public NotInheritable Class ItemRemovedEventArgs
    Inherits EventArgs

C#

public sealed class ItemRemovedEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
FolderDisplay name of the folder it was removed from.
KeptCopyWhich copy survives, for a duplicate ("source:folder"). For a blank message nothing is kept, and this says so.
MessageClassThe item's message class, e.g. "IPM.Note".
ReasonWhy it went, in words fit to show a user — e.g. "duplicate in the same folder: same Internet Message-ID", or "blank: no subject, no body, no attachments".
SenderNameSender display name, or "" when the item carried none.
SentSent/delivery time as "yyyy-MM-dd HH:mm", or "" when the item carried none.
SourceLabel of the source store the removed item came from.
SubjectSubject with any reply/forward prefix stripped. Empty for a blank message — having no subject is part of why it qualified.

Details

Folder property

Display name of the folder it was removed from.

VB.NET

Public ReadOnly Property Folder As String

C#

public string Folder { get; }

Property value

String

KeptCopy property

Which copy survives, for a duplicate ("source:folder"). For a blank message nothing is kept, and this says so.

VB.NET

Public ReadOnly Property KeptCopy As String

C#

public string KeptCopy { get; }

Property value

String

MessageClass property

The item's message class, e.g. "IPM.Note".

VB.NET

Public ReadOnly Property MessageClass As String

C#

public string MessageClass { get; }

Property value

String

Reason property

Why it went, in words fit to show a user — e.g. "duplicate in the same folder: same Internet Message-ID", or "blank: no subject, no body, no attachments".

VB.NET

Public ReadOnly Property Reason As String

C#

public string Reason { get; }

Property value

String

SenderName property

Sender display name, or "" when the item carried none.

VB.NET

Public ReadOnly Property SenderName As String

C#

public string SenderName { get; }

Property value

String

Sent property

Sent/delivery time as "yyyy-MM-dd HH:mm", or "" when the item carried none.

VB.NET

Public ReadOnly Property Sent As String

C#

public string Sent { get; }

Property value

String

Source property

Label of the source store the removed item came from.

VB.NET

Public ReadOnly Property Source As String

C#

public string Source { get; }

Property value

String

Subject property

Subject with any reply/forward prefix stripped. Empty for a blank message — having no subject is part of why it qualified.

VB.NET

Public ReadOnly Property Subject As String

C#

public string Subject { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

ModeEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.ModeChosen: which mode an input was processed in.

VB.NET

Public NotInheritable Class ModeEventArgs
    Inherits EventArgs

C#

public sealed class ModeEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
Mode
Operation
Path
SizeBytes

Details

Mode property

VB.NET

Public ReadOnly Property Mode As ProcessingMode

C#

public ProcessingMode Mode { get; }

Property value

ProcessingMode

Operation property

VB.NET

Public ReadOnly Property Operation As String

C#

public string Operation { get; }

Property value

String

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

SizeBytes property

VB.NET

Public ReadOnly Property SizeBytes As Long

C#

public long SizeBytes { get; }

Property value

Int64

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

ProcessingMode enumeration

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

How a single input store is processed.

VB.NET

Public Enum ProcessingMode

C#

public enum ProcessingMode

Members

NameValueDescription
Auto0Decide per input from its size vs DiagnosticsContext.InMemoryThresholdBytes.
InMemory1Buffer the input's converted nodes in memory (small inputs).
Streaming2Stream the input node-by-node (bounded memory; any size).

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace

ProgressEventArgs class

Namespace: Bastion.Pst.Diagnostics · Assembly: Bastion.Pst.dll

Payload for DiagnosticsContext.ReadProgress / DiagnosticsContext.WriteProgress.

VB.NET

Public NotInheritable Class ProgressEventArgs
    Inherits EventArgs

C#

public sealed class ProgressEventArgs : EventArgs

Inherits: EventArgs

Properties

NameDescription
CurrentFileThe file this progress is about — the source being read, or the output being written — or Nothing when the operation has no single file in view. Without it a host cannot show "reading X" and "writing Y" as separate progress, because DiagPhase.Read and DiagPhase.Write progress for a ten-source merge otherwise arrive as one anonymous stream of percentages that restart nine times and look like a stall.
CurrentItem
PercentComplete0..100, or -1 when Total is unknown.
Phase
Processed
TimestampUtc
TotalTotal items, or -1 when not known in advance.

Details

CurrentFile property

The file this progress is about — the source being read, or the output being written — or Nothing when the operation has no single file in view. Without it a host cannot show "reading X" and "writing Y" as separate progress, because DiagPhase.Read and DiagPhase.Write progress for a ten-source merge otherwise arrive as one anonymous stream of percentages that restart nine times and look like a stall.

VB.NET

Public ReadOnly Property CurrentFile As String

C#

public string CurrentFile { get; }

Property value

String

CurrentItem property

VB.NET

Public ReadOnly Property CurrentItem As String

C#

public string CurrentItem { get; }

Property value

String

PercentComplete property

0..100, or -1 when Total is unknown.

VB.NET

Public ReadOnly Property PercentComplete As Double

C#

public double PercentComplete { get; }

Property value

Double

Phase property

VB.NET

Public ReadOnly Property Phase As DiagPhase

C#

public DiagPhase Phase { get; }

Property value

DiagPhase

Processed property

VB.NET

Public ReadOnly Property Processed As Long

C#

public long Processed { get; }

Property value

Int64

TimestampUtc property

VB.NET

Public ReadOnly Property TimestampUtc As Date

C#

public DateTime TimestampUtc { get; }

Property value

DateTime

Total property

Total items, or -1 when not known in advance.

VB.NET

Public ReadOnly Property Total As Long

C#

public long Total { get; }

Property value

Int64

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Export namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
ExportReportResult of a bulk export (a whole PST to a folder of files): the standard error contract plus how many items were written, how many could not be, and how many were not of the kind the format carries.
ItemExporterExports non-mail items to their standard interchange formats: appointments to iCalendar (.ics, RFC 5545) and contacts to vCard (.vcf, RFC 6350). Clean-room from the public RFCs.
MessageExporterExports a single message to an interchange format: EML (RFC 5322 / MIME), Outlook .msg and .oft ([MS-OXMSG]), and MHTML. Clean-room from the public specifications.
StoreBuilderCreates new, empty Outlook data files. CreateEmpty writes a fresh, structurally-valid Unicode PST that mounts in Outlook — ready for a developer to add items to or merge other stores into. Never throws (a licence refusal aside).
StoreExporterBulk export: walk a PST/OST and write every message to its own interchange file, mirroring the folder tree on disk. Never throws — returns a ExportReport.
TextResultResult of converting one item to text (.eml, .mhtml, .ics, .vcf): the standard error contract plus the text.

Enumerations

NameDescription
ExportFormatInterchange formats Bastion PST SDK can export an item to. More are added per the export roadmap (MSG, MHTML, ICS, VCF, MBOX, OFT); EML is the first.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

ExportFormat enumeration

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Interchange formats Bastion PST SDK can export an item to. More are added per the export roadmap (MSG, MHTML, ICS, VCF, MBOX, OFT); EML is the first.

VB.NET

Public Enum ExportFormat

C#

public enum ExportFormat

Members

NameValueDescription
Eml0RFC 5322 / MIME internet message (.eml).
Msg1Outlook message file (.msg), [MS-OXMSG] compound file.
Ics2iCalendar appointment (.ics), RFC 5545 — appointment items only.
Vcf3vCard contact (.vcf), RFC 6350 — contact items only.
Mhtml4MIME HTML (.mhtml), RFC 2557 — a single-file web archive of the message.
Mbox5Unix mbox (.mbox): every message in a folder concatenated into one file.
Oft6Outlook template (.oft), [MS-OXMSG] compound file with the template root CLSID and the message marked unsent — the format Outlook's "Choose Form / User Templates" reads.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

ExportReport class

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Result of a bulk export (a whole PST to a folder of files): the standard error contract plus how many items were written, how many could not be, and how many were not of the kind the format carries.

VB.NET

Public NotInheritable Class ExportReport
    Inherits OperationResult

C#

public sealed class ExportReport : OperationResult

Inherits: OperationResult

Remarks

An export treats each item as independent and carries on past one it cannot read. When anything could not be read the result is ErrorCode.CompletedWithLosses (the files that could be written are there), with one OperationResult.Losses record per item, attachment or folder. When nothing at all was written and something failed, the result is an error code instead.

Constructors

NameDescription
ExportReport()

Properties

NameDescription
FailedNumber of items that could not be exported. Each is in Failures and is a LossKind.Message record in OperationResult.Losses. Any at all makes the result ErrorCode.CompletedWithLosses, not Ok.
FailuresOne line per item that could not be exported: the folder path, the item's node id and the reason. Never the subject or any other content of the item. Holds at most the first 1,000; Failed is the true total.
FilesWrittenNumber of items written to disk. Includes the ItemsIncomplete.
FoldersUnreadableNumber of folders whose list of messages or of subfolders could not be read, or could be read only in part. The items and folders it listed beyond the fault are missing from the export; each is a LossKind.Table record in OperationResult.Losses.
FoldersVisitedNumber of folders visited.
ItemsFoundNumber of items encountered while walking the store, counted before any format filter is applied. This is what tells "the store holds nothing" apart from "the store holds nothing of the kind this format can carry" when FilesWritten is zero — an empty output folder looks identical in both cases.
ItemsIncompleteNumber of items that were written but not whole: an attachment, an attached message or a body could not be read (or the format cannot carry it) and was left out, or a block of the item failed its checksum, so that what was written may be wrong. Each is a record in OperationResult.Losses.
SkippedNumber of items passed over because the format carries one kind of item only: everything but appointments for .ics, everything but contacts for .vcf. Not failures.
WarningNon-fatal note (e.g. "N item(s) skipped"), or Nothing.

Details

ExportReport() constructor

VB.NET

Public Sub New()

C#

public ExportReport();

Failed property

Number of items that could not be exported. Each is in Failures and is a LossKind.Message record in OperationResult.Losses. Any at all makes the result ErrorCode.CompletedWithLosses, not Ok.

VB.NET

Public Property Failed As Integer

C#

public int Failed { get; set; }

Property value

Int32

Failures property

One line per item that could not be exported: the folder path, the item's node id and the reason. Never the subject or any other content of the item. Holds at most the first 1,000; Failed is the true total.

VB.NET

Public ReadOnly Property Failures As IReadOnlyList(Of String)

C#

public IReadOnlyList<string> Failures { get; }

Property value

IReadOnlyList<String>

FilesWritten property

Number of items written to disk. Includes the ItemsIncomplete.

VB.NET

Public Property FilesWritten As Integer

C#

public int FilesWritten { get; set; }

Property value

Int32

FoldersUnreadable property

Number of folders whose list of messages or of subfolders could not be read, or could be read only in part. The items and folders it listed beyond the fault are missing from the export; each is a LossKind.Table record in OperationResult.Losses.

VB.NET

Public Property FoldersUnreadable As Integer

C#

public int FoldersUnreadable { get; set; }

Property value

Int32

FoldersVisited property

Number of folders visited.

VB.NET

Public Property FoldersVisited As Integer

C#

public int FoldersVisited { get; set; }

Property value

Int32

ItemsFound property

Number of items encountered while walking the store, counted before any format filter is applied. This is what tells "the store holds nothing" apart from "the store holds nothing of the kind this format can carry" when FilesWritten is zero — an empty output folder looks identical in both cases.

VB.NET

Public Property ItemsFound As Integer

C#

public int ItemsFound { get; set; }

Property value

Int32

ItemsIncomplete property

Number of items that were written but not whole: an attachment, an attached message or a body could not be read (or the format cannot carry it) and was left out, or a block of the item failed its checksum, so that what was written may be wrong. Each is a record in OperationResult.Losses.

VB.NET

Public Property ItemsIncomplete As Integer

C#

public int ItemsIncomplete { get; set; }

Property value

Int32

Skipped property

Number of items passed over because the format carries one kind of item only: everything but appointments for .ics, everything but contacts for .vcf. Not failures.

VB.NET

Public Property Skipped As Integer

C#

public int Skipped { get; set; }

Property value

Int32

Warning property

Non-fatal note (e.g. "N item(s) skipped"), or Nothing.

VB.NET

Public Property Warning As String

C#

public string Warning { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

ItemExporter class

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Exports non-mail items to their standard interchange formats: appointments to iCalendar (.ics, RFC 5545) and contacts to vCard (.vcf, RFC 6350). Clean-room from the public RFCs.

VB.NET

Public NotInheritable Class ItemExporter

C#

public sealed class ItemExporter

Remarks

Never throws for a failure of its own (a licence refusal is the exception, by design). The file-writing members return a FileOpResult and write atomically; the TryTo… members return a TextResult; the older To… members return the text alone, Nothing when the item could not be read.

Methods

NameDescription
ExportIcs(PstMessage, String, Boolean) staticWrite an appointment message to an iCalendar (.ics) file. A recurring appointment is written as a series: its rule (RRULE), its deleted occurrences (EXDATE), its changed occurrences (one VEVENT each, with RECURRENCE-ID) and the time zone it recurs in (VTIMEZONE).
ExportVcf(ContactView, String, Boolean) static

Write a projected contact ROW to a vCard file.

Use this for a card that ContactMerger assembled from several stored entries. Such a card has no single message behind it — its company came from one entry and its mobile number from another — so exporting it by node id would write whichever entry happened to be kept and quietly drop the rest, producing a file that says less than the card the user was looking at.

For an ordinary unmerged contact prefer the PstMessage overload: the stored message carries everything, including fields a display projection has no reason to hold.

ExportVcf(PstMessage, String, Boolean) staticWrite a contact message to a vCard (.vcf) file.
ToIcs(PstMessage) staticReturn the appointment as an iCalendar (VCALENDAR/VEVENT) string: "" if the message is not an appointment (or has no start time), and Nothing if it could not be read. Never throws. TryToIcs returns the same text together with the reason for a failure.
ToVcf(ContactView) staticReturn a projected contact row as a vCard 3.0 string, or "" if there is no row. Alternate addresses and numbers the merge gathered are written too, so nothing shown on the card is missing from the file. Never throws.
ToVcf(PstMessage) staticReturn the contact as a vCard 3.0 string: "" if the message is not a contact, and Nothing if it could not be read. Never throws. TryToVcf returns the same text together with the reason for a failure.
TryToIcs(PstMessage) staticReturn the appointment as an iCalendar (VCALENDAR/VEVENT) string, with the outcome. TextResult.Text is "" (and the code ErrorCode.InvalidArgument) when the message is not an appointment or is one with no start time, and Nothing when it could not be read.
TryToVcf(ContactView) staticReturn a projected contact row as a vCard 3.0 string, with the outcome.
TryToVcf(PstMessage) staticReturn the contact as a vCard 3.0 string, with the outcome. TextResult.Text is "" (and the code ErrorCode.InvalidArgument) when the message is not a contact, and Nothing when it could not be read.

Details

ExportIcs(PstMessage, String, Boolean) method static

Write an appointment message to an iCalendar (.ics) file. A recurring appointment is written as a series: its rule (RRULE), its deleted occurrences (EXDATE), its changed occurrences (one VEVENT each, with RECURRENCE-ID) and the time zone it recurs in (VTIMEZONE).

VB.NET

Public Shared Function ExportIcs(
    msg As PstMessage,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportIcs(PstMessage msg, string path, bool overwrite = true);

Parameters

msg PstMessage
path String
overwrite Boolean

Returns

FileOpResult

Remarks

An appointment with no start time is not written: an iCalendar event must have one. The result is ErrorCode.InvalidArgument and says so.

ExportVcf(ContactView, String, Boolean) method static

Write a projected contact ROW to a vCard file.

Use this for a card that ContactMerger assembled from several stored entries. Such a card has no single message behind it — its company came from one entry and its mobile number from another — so exporting it by node id would write whichever entry happened to be kept and quietly drop the rest, producing a file that says less than the card the user was looking at.

For an ordinary unmerged contact prefer the PstMessage overload: the stored message carries everything, including fields a display projection has no reason to hold.

VB.NET

Public Shared Function ExportVcf(
    contact As ContactView,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportVcf(ContactView contact, string path, bool overwrite = true);

Parameters

contact ContactView
path String
overwrite Boolean

Returns

FileOpResult

ExportVcf(PstMessage, String, Boolean) method static

Write a contact message to a vCard (.vcf) file.

VB.NET

Public Shared Function ExportVcf(
    msg As PstMessage,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportVcf(PstMessage msg, string path, bool overwrite = true);

Parameters

msg PstMessage
path String
overwrite Boolean

Returns

FileOpResult

ToIcs(PstMessage) method static

Return the appointment as an iCalendar (VCALENDAR/VEVENT) string: "" if the message is not an appointment (or has no start time), and Nothing if it could not be read. Never throws. TryToIcs returns the same text together with the reason for a failure.

VB.NET

Public Shared Function ToIcs(msg As PstMessage) As String

C#

public static string ToIcs(PstMessage msg);

Parameters

msg PstMessage

Returns

String

ToVcf(ContactView) method static

Return a projected contact row as a vCard 3.0 string, or "" if there is no row. Alternate addresses and numbers the merge gathered are written too, so nothing shown on the card is missing from the file. Never throws.

VB.NET

Public Shared Function ToVcf(contact As ContactView) As String

C#

public static string ToVcf(ContactView contact);

Parameters

contact ContactView

Returns

String

ToVcf(PstMessage) method static

Return the contact as a vCard 3.0 string: "" if the message is not a contact, and Nothing if it could not be read. Never throws. TryToVcf returns the same text together with the reason for a failure.

VB.NET

Public Shared Function ToVcf(msg As PstMessage) As String

C#

public static string ToVcf(PstMessage msg);

Parameters

msg PstMessage

Returns

String

TryToIcs(PstMessage) method static

Return the appointment as an iCalendar (VCALENDAR/VEVENT) string, with the outcome. TextResult.Text is "" (and the code ErrorCode.InvalidArgument) when the message is not an appointment or is one with no start time, and Nothing when it could not be read.

VB.NET

Public Shared Function TryToIcs(msg As PstMessage) As TextResult

C#

public static TextResult TryToIcs(PstMessage msg);

Parameters

msg PstMessage

Returns

TextResult

TryToVcf(ContactView) method static

Return a projected contact row as a vCard 3.0 string, with the outcome.

VB.NET

Public Shared Function TryToVcf(contact As ContactView) As TextResult

C#

public static TextResult TryToVcf(ContactView contact);

Parameters

contact ContactView

Returns

TextResult

TryToVcf(PstMessage) method static

Return the contact as a vCard 3.0 string, with the outcome. TextResult.Text is "" (and the code ErrorCode.InvalidArgument) when the message is not a contact, and Nothing when it could not be read.

VB.NET

Public Shared Function TryToVcf(msg As PstMessage) As TextResult

C#

public static TextResult TryToVcf(PstMessage msg);

Parameters

msg PstMessage

Returns

TextResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

MessageExporter class

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Exports a single message to an interchange format: EML (RFC 5322 / MIME), Outlook .msg and .oft ([MS-OXMSG]), and MHTML. Clean-room from the public specifications.

VB.NET

Public NotInheritable Class MessageExporter

C#

public sealed class MessageExporter

Remarks

Never throws for a failure of its own (a licence refusal is the exception, by design): the file-writing members return a FileOpResult and the TryTo… members a TextResult.

An item whose own properties cannot be read is not exported, and the result says why. An item with a PART that cannot be read (an attachment, an attached message, a body) is exported without that part, never with an empty stand-in for it, and the result is ErrorCode.CompletedWithLosses with the part named in OperationResult.Losses.

Files are written to a temporary name and moved into place, so a failed write leaves no truncated file under the name asked for, and an existing file there is untouched.

Methods

NameDescription
ExportEml(PstMessage, String, Boolean) staticWrite msg to path as a MIME .eml file.
ExportMhtml(PstMessage, String, Boolean) staticWrite msg to path as MIME HTML (.mhtml, RFC 2557) — a single-file web archive (HTML body plus inline resources).
ExportMsg(PstMessage, String, Boolean) staticWrite msg to path as an Outlook .msg file ([MS-OXMSG] compound file), with every property of the item, its recipients and its attachments that the format can hold.
ExportOft(PstMessage, String, Boolean) staticWrite msg to path as an Outlook template (.oft): an [MS-OXMSG] compound file with the template root CLSID and the message marked unsent — the form Outlook loads from "Choose Form / User Templates".
ToEml(PstMessage) staticReturn msg as a MIME (.eml) string: "" when there is no message, and Nothing when the message could not be read. Never throws. TryToEml returns the same text together with the reason for a failure and any part of the message that had to be left out.
ToMhtml(PstMessage) staticReturn msg as an MHTML (.mhtml) string: "" when there is no message, and Nothing when the message could not be read. Never throws. TryToMhtml returns the same text together with the reason for a failure.
TryToEml(PstMessage) staticReturn msg as a MIME (.eml) string, with the outcome. TextResult.Text is Nothing when the message could not be read.
TryToMhtml(PstMessage) staticReturn msg as an MHTML (.mhtml) string, with the outcome. TextResult.Text is Nothing when the message could not be read.

Details

ExportEml(PstMessage, String, Boolean) method static

Write msg to path as a MIME .eml file.

VB.NET

Public Shared Function ExportEml(
    msg As PstMessage,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportEml(PstMessage msg, string path, bool overwrite = true);

Parameters

msg PstMessage
path String
overwrite Boolean

Returns

FileOpResult

ExportMhtml(PstMessage, String, Boolean) method static

Write msg to path as MIME HTML (.mhtml, RFC 2557) — a single-file web archive (HTML body plus inline resources).

VB.NET

Public Shared Function ExportMhtml(
    msg As PstMessage,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportMhtml(PstMessage msg, string path, bool overwrite = true);

Parameters

msg PstMessage
path String
overwrite Boolean

Returns

FileOpResult

ExportMsg(PstMessage, String, Boolean) method static

Write msg to path as an Outlook .msg file ([MS-OXMSG] compound file), with every property of the item, its recipients and its attachments that the format can hold.

VB.NET

Public Shared Function ExportMsg(
    msg As PstMessage,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportMsg(PstMessage msg, string path, bool overwrite = true);

Parameters

msg PstMessage
path String
overwrite Boolean

Returns

FileOpResult

ExportOft(PstMessage, String, Boolean) method static

Write msg to path as an Outlook template (.oft): an [MS-OXMSG] compound file with the template root CLSID and the message marked unsent — the form Outlook loads from "Choose Form / User Templates".

VB.NET

Public Shared Function ExportOft(
    msg As PstMessage,
    path As String,
    Optional overwrite As Boolean = True
) As FileOpResult

C#

public static FileOpResult ExportOft(PstMessage msg, string path, bool overwrite = true);

Parameters

msg PstMessage
path String
overwrite Boolean

Returns

FileOpResult

ToEml(PstMessage) method static

Return msg as a MIME (.eml) string: "" when there is no message, and Nothing when the message could not be read. Never throws. TryToEml returns the same text together with the reason for a failure and any part of the message that had to be left out.

VB.NET

Public Shared Function ToEml(msg As PstMessage) As String

C#

public static string ToEml(PstMessage msg);

Parameters

msg PstMessage

Returns

String

ToMhtml(PstMessage) method static

Return msg as an MHTML (.mhtml) string: "" when there is no message, and Nothing when the message could not be read. Never throws. TryToMhtml returns the same text together with the reason for a failure.

VB.NET

Public Shared Function ToMhtml(msg As PstMessage) As String

C#

public static string ToMhtml(PstMessage msg);

Parameters

msg PstMessage

Returns

String

TryToEml(PstMessage) method static

Return msg as a MIME (.eml) string, with the outcome. TextResult.Text is Nothing when the message could not be read.

VB.NET

Public Shared Function TryToEml(msg As PstMessage) As TextResult

C#

public static TextResult TryToEml(PstMessage msg);

Parameters

msg PstMessage

Returns

TextResult

TryToMhtml(PstMessage) method static

Return msg as an MHTML (.mhtml) string, with the outcome. TextResult.Text is Nothing when the message could not be read.

VB.NET

Public Shared Function TryToMhtml(msg As PstMessage) As TextResult

C#

public static TextResult TryToMhtml(PstMessage msg);

Parameters

msg PstMessage

Returns

TextResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

StoreBuilder class

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Creates new, empty Outlook data files. CreateEmpty writes a fresh, structurally-valid Unicode PST that mounts in Outlook — ready for a developer to add items to or merge other stores into. Never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class StoreBuilder

C#

public sealed class StoreBuilder

Methods

NameDescription
CreateEmpty(String, Boolean, String) staticCreate a new, empty PST at path — an Outlook-mountable store with the standard root hierarchy and no messages. The new file is validated (reopened) BEFORE it is moved into place: if it does not open, the result is ErrorCode.OutputInvalid, nothing is left at path, and a file that was already there is untouched. FileOpResult.Path is set only on success.

Details

CreateEmpty(String, Boolean, String) method static

Create a new, empty PST at path — an Outlook-mountable store with the standard root hierarchy and no messages. The new file is validated (reopened) BEFORE it is moved into place: if it does not open, the result is ErrorCode.OutputInvalid, nothing is left at path, and a file that was already there is untouched. FileOpResult.Path is set only on success.

VB.NET

Public Shared Function CreateEmpty(
    path As String,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As FileOpResult

C#

public static FileOpResult CreateEmpty(string path, bool overwrite = false, string storeName = null);

Parameters

path String
Destination .pst path.
overwrite Boolean
Replace the file if it already exists.
storeName String
Optional display name Outlook shows for the store in its nav pane. When omitted the store keeps the template's default name ("Outlook Data File").

Returns

FileOpResult

Remarks

The store is always a Unicode PST (the format of Outlook 2003 and later), with or without a name. Until 11 Nov 2026 the unnamed form wrote a legacy ANSI store: limited to 2 GB, and refused by the very next call that added anything to it (ErrorCode.AnsiUpgradeRequired).

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

StoreExporter class

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Bulk export: walk a PST/OST and write every message to its own interchange file, mirroring the folder tree on disk. Never throws — returns a ExportReport.

VB.NET

Public NotInheritable Class StoreExporter

C#

public sealed class StoreExporter

Methods

NameDescription
ExportToFolder(String, String, ExportFormat, DiagnosticsContext, Boolean) staticExport every message in pstPath to outDir, one file per message under a folder tree that mirrors the store (for ExportFormat.Mbox, one .mbox file per folder).

Details

ExportToFolder(String, String, ExportFormat, DiagnosticsContext, Boolean) method static

Export every message in pstPath to outDir, one file per message under a folder tree that mirrors the store (for ExportFormat.Mbox, one .mbox file per folder).

VB.NET

Public Shared Function ExportToFolder(
    pstPath As String,
    outDir As String,
    Optional format As ExportFormat = ExportFormat.Eml,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True
) As ExportReport

C#

public static ExportReport ExportToFolder(
    string pstPath,
    string outDir,
    ExportFormat format = ExportFormat.Eml,
    DiagnosticsContext diag = null,
    bool overwrite = true
);

Parameters

pstPath String
outDir String
format ExportFormat
diag DiagnosticsContext
overwrite Boolean
For ExportFormat.Mbox: when False, an .mbox file that already exists stops the export with ErrorCode.DestinationExists. For the one-file-per-item formats it has no effect: an existing file is NEVER overwritten, the new one is given a free name ("name (2).eml"), so exporting twice into one folder adds to it.

Returns

ExportReport

Remarks

Each item is independent. One that cannot be read is counted in ExportReport.Failed, listed in ExportReport.Failures and recorded in OperationResult.Losses, and the export carries on; so does a folder whose list of messages cannot be read (ExportReport.FoldersUnreadable). The result is then ErrorCode.CompletedWithLosses, whether or not RecoverFromCorruption is set: an export is how mail is got OUT of a damaged file, and stopping at the first bad item would defeat it. If nothing could be written and something failed, the result is an error code.

An item is never written with something silently missing: an attachment or an attached message that cannot be read is left out (not replaced by an empty file of the same name), recorded, and the item counted in ExportReport.ItemsIncomplete.

Every file is written under a temporary name and moved into place, so no truncated file is left behind. A failure of the DESTINATION (disk full, access denied) stops the export with that error; so does cancellation. Files already written stay.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace

TextResult class

Namespace: Bastion.Pst.Export · Assembly: Bastion.Pst.dll

Result of converting one item to text (.eml, .mhtml, .ics, .vcf): the standard error contract plus the text.

VB.NET

Public NotInheritable Class TextResult
    Inherits OperationResult

C#

public sealed class TextResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
TextResult()

Properties

NameDescription
TextThe text. "" when there was nothing to convert (no item was supplied, or the item is not of the kind the format carries); Nothing when the item could not be read. With ErrorCode.CompletedWithLosses the text is there but a part of the item is missing from it: see OperationResult.Losses.

Details

TextResult() constructor

VB.NET

Public Sub New()

C#

public TextResult();

Text property

The text. "" when there was nothing to convert (no item was supplied, or the item is not of the kind the format carries); Nothing when the item could not be read. With ErrorCode.CompletedWithLosses the text is there but a part of the item is missing from it: see OperationResult.Losses.

VB.NET

Public Property Text As String

C#

public string Text { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Import namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
EmlReaderParses an RFC 5322 / MIME message (.eml) into a ImportedMessage. Clean-room from the public RFCs; validates the input and never throws (a licence refusal aside).
IcsReaderReads an iCalendar (.ics) file: each VEVENT as an appointment-kind ImportedMessage (a recurring one with its recurrence pattern), each VTODO as a task and each VJOURNAL as a journal entry. Malformed components are skipped; never throws (a licence refusal aside).
ImportedAddressA name/email pair parsed from an address header.
ImportedAppointmentAppointment fields parsed from an iCalendar VEVENT (RFC 5545). Attendees ride in the owning message's To list; SUMMARY/DESCRIPTION in Subject/BodyText.
ImportedAttachmentAn attachment parsed from an imported message.
ImportedContactContact fields parsed from a vCard (RFC 6350 / 2425; 2.1–4.0 tolerated).
ImportedDistListDistribution-list fields ([MS-OXOABK]): the list name and its one-off members.
ImportedDistListMemberA distribution-list member (a one-off recipient: display name + SMTP address).
ImportedJournalJournal-entry fields ([MS-OXOJRNL]).
ImportedMessageA message read from an interchange file (EML, MSG, MBOX). This is the neutral, fully-materialised model the import readers produce — inspect it, or hand it to an exporter to convert between formats.
ImportedNoteSticky-note fields ([MS-OXONOTE]). The note text is the message BodyText. Color: 0 blue,1 green,2 pink,3 yellow (default),4 white.
ImportedOccurrenceOverrideAn override of ONE occurrence of a recurring series ([MS-OXOCAL] ExceptionInfo / ExtendedException): the occurrence generated on OriginalDate is moved and/or re-titled. Members left unset inherit the series value.
ImportedRecurrenceRecurrence pattern for an authored or imported appointment ([MS-OXOCAL] 2.2.1.44). The forms Outlook's own model has: daily (every N days), weekly (on selected weekdays, every N weeks), monthly and yearly (on a day of the month, or on the first to fourth or last of a set of weekdays), ending after a count, on a date, or never.
ImportedRssRSS post fields ([MS-OXOPOST] / PSETID_PostRss). The article body is the message BodyText/BodyHtml; the channel is the feed the item arrived from.
ImportedTaskTask fields ([MS-OXOTASK]). Status 0=not started,1=in progress,2=complete, 3=waiting,4=deferred; PercentComplete is 0..1.
ImportManyResult

Result of reading a file that can hold many items (an mbox, an .olm archive, an iCalendar or vCard file): the standard error contract, the items read, and how many entries the file held against how many could not be read. The three outcomes a bare collection could not tell apart:

When some entries could be read and some could not, Messages holds the ones that could, the code is ErrorCode.CompletedWithLosses and OperationResult.Losses names each one that could not.

ImportReportResult of an import run: the standard error contract plus counts. A per-file parse failure does not fail the run — it is recorded in Failures and in OperationResult.Losses, the remaining files import normally, and the code is ErrorCode.CompletedWithLosses; the run fails only when NO message could be imported. The counts are of what was written: on a failed run they are zero.
ImportResultResult of importing a single message: the standard error contract plus the message.
MboxReaderReads a Unix mbox file into ImportedMessages. Never throws (a licence refusal aside).
MsgReaderParses an Outlook .msg file ([MS-OXMSG] over [MS-CFB]) into a ImportedMessage. Clean-room; validates the container and never throws (a licence refusal aside).
OlmReaderReads Outlook-for-Mac .olm archives (mail items, with folder placement) into the neutral import model. Contacts/calendar/etc. live in separate consolidated XML files and are a later increment; this reads the per-message mail (message_NNNNN.xml).
StoreImporterImports EML / MSG / MBOX / ICS / VCF files into a folder of a PST. pstPath is the store to import into (its content is preserved); pass Nothing/empty to start from a new, empty store. The result is always written to outPath — the input store is never modified. Never throws (a licence refusal aside).
TnefReaderDecodes TNEF (winmail.dat) streams into real attachments ([MS-OXTNEF]). Tolerant of damage; never throws into the caller (a licence refusal aside).
TnefResultResult of decoding a TNEF stream: the standard error contract, the recovered attachments and bodies, plus damage counters (bad checksums / truncated attributes).
VcfReaderReads a vCard (.vcf) file: yields each card as a contact-kind ImportedMessage. Malformed cards are skipped; never throws (a licence refusal aside).

Enumerations

NameDescription
ImportedItemKindWhat kind of Outlook item an imported file parsed into. Mail is the default; Appointment/Contact are produced by the ICS and VCF readers (Import Phase 4); Task/Note are produced by the authoring API (Phase 2.3) — no interchange reader emits them.
RecurDaysDays-of-week bitmask for a weekly recurrence (matches [MS-OXOCAL] PatternTypeWeek).
RecurFrequencyRecurrence frequency for an authored or imported appointment.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

EmlReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Parses an RFC 5322 / MIME message (.eml) into a ImportedMessage. Clean-room from the public RFCs; validates the input and never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class EmlReader

C#

public sealed class EmlReader

Remarks

The result's code is ErrorCode.FileNotFound for a missing file, ErrorCode.InvalidInputFile for a file that is empty or is not a mail message, and ErrorCode.CompletedWithLosses when the message was read but part of it was damaged (an attachment that would not decode, a date that could not be read): then ImportResult.Message is set and OperationResult.Losses says what.

Methods

NameDescription
Parse(Byte[]) staticParse raw .eml bytes into a message model.
ParseFile(String) staticParse an .eml file into a message model.

Details

Parse(Byte[]) method static

Parse raw .eml bytes into a message model.

VB.NET

Public Shared Function Parse(bytes As Byte()) As ImportResult

C#

public static ImportResult Parse(byte[] bytes);

Parameters

bytes Byte[]

Returns

ImportResult

ParseFile(String) method static

Parse an .eml file into a message model.

VB.NET

Public Shared Function ParseFile(path As String) As ImportResult

C#

public static ImportResult ParseFile(string path);

Parameters

path String

Returns

ImportResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

IcsReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Reads an iCalendar (.ics) file: each VEVENT as an appointment-kind ImportedMessage (a recurring one with its recurrence pattern), each VTODO as a task and each VJOURNAL as a journal entry. Malformed components are skipped; never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class IcsReader

C#

public sealed class IcsReader

Methods

NameDescription
Parse(String) staticParse iCalendar text: one imported item per VEVENT, VTODO and VJOURNAL. Never throws (a licence refusal aside); text that is not a calendar gives an empty list.
ReadFile(String) staticEnumerate every event, task and journal entry in an .ics file. Never throws (a licence refusal aside) and returns what could be read: use TryReadFile to learn whether the file was missing, was not a calendar, or held things that were not imported.
TryReadFile(String) staticRead every event, task and journal entry in an .ics file and say how it went: the items, how many components the file held, how many were not imported, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not an iCalendar file (ErrorCode.InvalidInputFile) from a calendar with nothing in it (Ok, no messages). A changed occurrence of a series (RECURRENCE-ID) is counted in ImportManyResult.EntriesSeen and carried inside its series, so it is not a message of its own.

Details

Parse(String) method static

Parse iCalendar text: one imported item per VEVENT, VTODO and VJOURNAL. Never throws (a licence refusal aside); text that is not a calendar gives an empty list.

VB.NET

Public Shared Function Parse(text As String) As List(Of ImportedMessage)

C#

public static List<ImportedMessage> Parse(string text);

Parameters

text String

Returns

List<ImportedMessage>

ReadFile(String) method static

Enumerate every event, task and journal entry in an .ics file. Never throws (a licence refusal aside) and returns what could be read: use TryReadFile to learn whether the file was missing, was not a calendar, or held things that were not imported.

VB.NET

Public Shared Function ReadFile(path As String) As IEnumerable(Of ImportedMessage)

C#

public static IEnumerable<ImportedMessage> ReadFile(string path);

Parameters

path String

Returns

IEnumerable<ImportedMessage>

TryReadFile(String) method static

Read every event, task and journal entry in an .ics file and say how it went: the items, how many components the file held, how many were not imported, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not an iCalendar file (ErrorCode.InvalidInputFile) from a calendar with nothing in it (Ok, no messages). A changed occurrence of a series (RECURRENCE-ID) is counted in ImportManyResult.EntriesSeen and carried inside its series, so it is not a message of its own.

VB.NET

Public Shared Function TryReadFile(path As String) As ImportManyResult

C#

public static ImportManyResult TryReadFile(string path);

Parameters

path String

Returns

ImportManyResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedAddress class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

A name/email pair parsed from an address header.

VB.NET

Public NotInheritable Class ImportedAddress

C#

public sealed class ImportedAddress

Constructors

NameDescription
ImportedAddress()

Properties

NameDescription
Email
Name

Methods

NameDescription
ToString()

Details

ImportedAddress() constructor

VB.NET

Public Sub New()

C#

public ImportedAddress();

Email property

VB.NET

Public Property Email As String

C#

public string Email { get; set; }

Property value

String

Name property

VB.NET

Public Property Name As String

C#

public string Name { get; set; }

Property value

String

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedAppointment class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Appointment fields parsed from an iCalendar VEVENT (RFC 5545). Attendees ride in the owning message's To list; SUMMARY/DESCRIPTION in Subject/BodyText.

VB.NET

Public NotInheritable Class ImportedAppointment

C#

public sealed class ImportedAppointment

Constructors

NameDescription
ImportedAppointment()

Properties

NameDescription
BusyStatusolBusyStatus: 0 free, 1 tentative, 2 busy, 3 out of office.
EndTime
IsAllDayTrue for a VALUE=DATE (all-day) event.
Location
RecurrenceRecurrence pattern, or Nothing for a single-instance appointment.
ReminderMinutesBeforeStart
ReminderSet
StartTime
UidThe event's UID, also mirrored into the message's MessageId.

Details

ImportedAppointment() constructor

VB.NET

Public Sub New()

C#

public ImportedAppointment();

BusyStatus property

olBusyStatus: 0 free, 1 tentative, 2 busy, 3 out of office.

VB.NET

Public Property BusyStatus As Integer

C#

public int BusyStatus { get; set; }

Property value

Int32

EndTime property

VB.NET

Public Property EndTime As Date?

C#

public DateTime? EndTime { get; set; }

Property value

Nullable<DateTime>

IsAllDay property

True for a VALUE=DATE (all-day) event.

VB.NET

Public Property IsAllDay As Boolean

C#

public bool IsAllDay { get; set; }

Property value

Boolean

Location property

VB.NET

Public Property Location As String

C#

public string Location { get; set; }

Property value

String

Recurrence property

Recurrence pattern, or Nothing for a single-instance appointment.

VB.NET

Public Property Recurrence As ImportedRecurrence

C#

public ImportedRecurrence Recurrence { get; set; }

Property value

ImportedRecurrence

ReminderMinutesBeforeStart property

VB.NET

Public Property ReminderMinutesBeforeStart As Integer

C#

public int ReminderMinutesBeforeStart { get; set; }

Property value

Int32

ReminderSet property

VB.NET

Public Property ReminderSet As Boolean

C#

public bool ReminderSet { get; set; }

Property value

Boolean

StartTime property

VB.NET

Public Property StartTime As Date?

C#

public DateTime? StartTime { get; set; }

Property value

Nullable<DateTime>

Uid property

The event's UID, also mirrored into the message's MessageId.

VB.NET

Public Property Uid As String

C#

public string Uid { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedAttachment class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

An attachment parsed from an imported message.

VB.NET

Public NotInheritable Class ImportedAttachment

C#

public sealed class ImportedAttachment

Constructors

NameDescription
ImportedAttachment()

Properties

NameDescription
ContentId
Data
EmbeddedMessageSet when the attachment is itself a message (message/rfc822 part in EML, nested .msg storage in MSG): the parsed message. The importer writes it into the PST as a true embedded-message attachment (afEmbeddedMessage). Data keeps the raw bytes (when the source had them) purely as a fallback.
FileName
IsContactPhotoTrue for a contact's photo: written with PidTagAttachmentContactPhoto so Outlook renders it as the contact picture rather than a normal file attachment.
IsInline
MimeType

Details

ImportedAttachment() constructor

VB.NET

Public Sub New()

C#

public ImportedAttachment();

ContentId property

VB.NET

Public Property ContentId As String

C#

public string ContentId { get; set; }

Property value

String

Data property

VB.NET

Public Property Data As Byte()

C#

public byte[] Data { get; set; }

Property value

Byte[]

EmbeddedMessage property

Set when the attachment is itself a message (message/rfc822 part in EML, nested .msg storage in MSG): the parsed message. The importer writes it into the PST as a true embedded-message attachment (afEmbeddedMessage). Data keeps the raw bytes (when the source had them) purely as a fallback.

VB.NET

Public Property EmbeddedMessage As ImportedMessage

C#

public ImportedMessage EmbeddedMessage { get; set; }

Property value

ImportedMessage

FileName property

VB.NET

Public Property FileName As String

C#

public string FileName { get; set; }

Property value

String

IsContactPhoto property

True for a contact's photo: written with PidTagAttachmentContactPhoto so Outlook renders it as the contact picture rather than a normal file attachment.

VB.NET

Public Property IsContactPhoto As Boolean

C#

public bool IsContactPhoto { get; set; }

Property value

Boolean

IsInline property

VB.NET

Public Property IsInline As Boolean

C#

public bool IsInline { get; set; }

Property value

Boolean

MimeType property

VB.NET

Public Property MimeType As String

C#

public string MimeType { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedContact class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Contact fields parsed from a vCard (RFC 6350 / 2425; 2.1–4.0 tolerated).

VB.NET

Public NotInheritable Class ImportedContact

C#

public sealed class ImportedContact

Constructors

NameDescription
ImportedContact()

Properties

NameDescription
Anniversary
Birthday
BusinessAddressSingle-string postal addresses (the reader joins ADR components).
BusinessFax
BusinessTelephone
CompanyName
Department
DisplayName
Email1Address
Email2Address
Email3Address
GivenName
HomeAddress
HomeTelephone
JobTitle
MiddleName
MobileTelephone
Surname
WebPage

Details

ImportedContact() constructor

VB.NET

Public Sub New()

C#

public ImportedContact();

Anniversary property

VB.NET

Public Property Anniversary As Date?

C#

public DateTime? Anniversary { get; set; }

Property value

Nullable<DateTime>

Birthday property

VB.NET

Public Property Birthday As Date?

C#

public DateTime? Birthday { get; set; }

Property value

Nullable<DateTime>

BusinessAddress property

Single-string postal addresses (the reader joins ADR components).

VB.NET

Public Property BusinessAddress As String

C#

public string BusinessAddress { get; set; }

Property value

String

BusinessFax property

VB.NET

Public Property BusinessFax As String

C#

public string BusinessFax { get; set; }

Property value

String

BusinessTelephone property

VB.NET

Public Property BusinessTelephone As String

C#

public string BusinessTelephone { get; set; }

Property value

String

CompanyName property

VB.NET

Public Property CompanyName As String

C#

public string CompanyName { get; set; }

Property value

String

Department property

VB.NET

Public Property Department As String

C#

public string Department { get; set; }

Property value

String

DisplayName property

VB.NET

Public Property DisplayName As String

C#

public string DisplayName { get; set; }

Property value

String

Email1Address property

VB.NET

Public Property Email1Address As String

C#

public string Email1Address { get; set; }

Property value

String

Email2Address property

VB.NET

Public Property Email2Address As String

C#

public string Email2Address { get; set; }

Property value

String

Email3Address property

VB.NET

Public Property Email3Address As String

C#

public string Email3Address { get; set; }

Property value

String

GivenName property

VB.NET

Public Property GivenName As String

C#

public string GivenName { get; set; }

Property value

String

HomeAddress property

VB.NET

Public Property HomeAddress As String

C#

public string HomeAddress { get; set; }

Property value

String

HomeTelephone property

VB.NET

Public Property HomeTelephone As String

C#

public string HomeTelephone { get; set; }

Property value

String

JobTitle property

VB.NET

Public Property JobTitle As String

C#

public string JobTitle { get; set; }

Property value

String

MiddleName property

VB.NET

Public Property MiddleName As String

C#

public string MiddleName { get; set; }

Property value

String

MobileTelephone property

VB.NET

Public Property MobileTelephone As String

C#

public string MobileTelephone { get; set; }

Property value

String

Surname property

VB.NET

Public Property Surname As String

C#

public string Surname { get; set; }

Property value

String

WebPage property

VB.NET

Public Property WebPage As String

C#

public string WebPage { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedDistList class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Distribution-list fields ([MS-OXOABK]): the list name and its one-off members.

VB.NET

Public NotInheritable Class ImportedDistList

C#

public sealed class ImportedDistList

Constructors

NameDescription
ImportedDistList()

Properties

NameDescription
Members
Name

Details

ImportedDistList() constructor

VB.NET

Public Sub New()

C#

public ImportedDistList();

Members property

VB.NET

Public Property Members As List(Of ImportedDistListMember)

C#

public List<ImportedDistListMember> Members { get; set; }

Property value

List<ImportedDistListMember>

Name property

VB.NET

Public Property Name As String

C#

public string Name { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedDistListMember class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

A distribution-list member (a one-off recipient: display name + SMTP address).

VB.NET

Public NotInheritable Class ImportedDistListMember

C#

public sealed class ImportedDistListMember

Constructors

NameDescription
ImportedDistListMember()

Properties

NameDescription
DisplayName
Email

Details

ImportedDistListMember() constructor

VB.NET

Public Sub New()

C#

public ImportedDistListMember();

DisplayName property

VB.NET

Public Property DisplayName As String

C#

public string DisplayName { get; set; }

Property value

String

Email property

VB.NET

Public Property Email As String

C#

public string Email { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedItemKind enumeration

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

What kind of Outlook item an imported file parsed into. Mail is the default; Appointment/Contact are produced by the ICS and VCF readers (Import Phase 4); Task/Note are produced by the authoring API (Phase 2.3) — no interchange reader emits them.

VB.NET

Public Enum ImportedItemKind

C#

public enum ImportedItemKind

Members

NameValueDescription
Mail0
Appointment1
Contact2
Task3
Note4
Journal5
DistributionList6
Rss7

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedJournal class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Journal-entry fields ([MS-OXOJRNL]).

VB.NET

Public NotInheritable Class ImportedJournal

C#

public sealed class ImportedJournal

Constructors

NameDescription
ImportedJournal()

Properties

NameDescription
DurationMinutes
EndTime
JournalTypeFree-text activity type, e.g. "Phone call", "E-mail Message".
StartTime

Details

ImportedJournal() constructor

VB.NET

Public Sub New()

C#

public ImportedJournal();

DurationMinutes property

VB.NET

Public Property DurationMinutes As Integer

C#

public int DurationMinutes { get; set; }

Property value

Int32

EndTime property

VB.NET

Public Property EndTime As Date?

C#

public DateTime? EndTime { get; set; }

Property value

Nullable<DateTime>

JournalType property

Free-text activity type, e.g. "Phone call", "E-mail Message".

VB.NET

Public Property JournalType As String

C#

public string JournalType { get; set; }

Property value

String

StartTime property

VB.NET

Public Property StartTime As Date?

C#

public DateTime? StartTime { get; set; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedMessage class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

A message read from an interchange file (EML, MSG, MBOX). This is the neutral, fully-materialised model the import readers produce — inspect it, or hand it to an exporter to convert between formats.

VB.NET

Public NotInheritable Class ImportedMessage

C#

public sealed class ImportedMessage

Constructors

NameDescription
ImportedMessage()

Properties

NameDescription
AppointmentAppointment payload when Kind is Appointment, else Nothing.
Attachments
Bcc
BodyHtml
BodyText
Cc
ContactContact payload when Kind is Contact, else Nothing.
Date
DistListDistribution-list payload when Kind is DistributionList, else Nothing.
FromEmail
FromName
HeadersAll raw header name/value pairs, in order.
ImportancePidTagImportance: 0 low, 1 normal (default), 2 high.
IsReadWhether the item is marked read (MSGFLAG_READ). Defaults True; the .msg reader sets it from the file, so an unread message stays unread. Set False to author an unread item.
JournalJournal payload when Kind is Journal, else Nothing.
KindItem kind: Mail (default), or Appointment / Contact from the ICS / VCF readers. The importer composes the matching Outlook item class.
MessageClassThe Outlook message class to write for a ImportedItemKind.Mail item, such as IPM.Note.SMIME or REPORT.IPM.Note.NDR. Empty (the default) writes IPM.Note. The .msg reader sets it from the file, so an item that was not plain mail keeps its class; the other kinds write their own class and ignore this.
MessageId
NoteNote payload when Kind is Note, else Nothing.
RssRSS-post payload when Kind is Rss, else Nothing.
SourceFolderThe folder path this item came from (set by readers that carry a folder tree, e.g. the OLM reader). Empty for flat interchange files. Used to place the item on import.
Subject
TaskTask payload when Kind is Task, else Nothing.
To

Methods

NameDescription
ToString()

Details

ImportedMessage() constructor

VB.NET

Public Sub New()

C#

public ImportedMessage();

Appointment property

Appointment payload when Kind is Appointment, else Nothing.

VB.NET

Public Property Appointment As ImportedAppointment

C#

public ImportedAppointment Appointment { get; set; }

Property value

ImportedAppointment

Attachments property

VB.NET

Public Property Attachments As List(Of ImportedAttachment)

C#

public List<ImportedAttachment> Attachments { get; set; }

Property value

List<ImportedAttachment>

Bcc property

VB.NET

Public Property Bcc As List(Of ImportedAddress)

C#

public List<ImportedAddress> Bcc { get; set; }

Property value

List<ImportedAddress>

BodyHtml property

VB.NET

Public Property BodyHtml As String

C#

public string BodyHtml { get; set; }

Property value

String

BodyText property

VB.NET

Public Property BodyText As String

C#

public string BodyText { get; set; }

Property value

String

Cc property

VB.NET

Public Property Cc As List(Of ImportedAddress)

C#

public List<ImportedAddress> Cc { get; set; }

Property value

List<ImportedAddress>

Contact property

Contact payload when Kind is Contact, else Nothing.

VB.NET

Public Property Contact As ImportedContact

C#

public ImportedContact Contact { get; set; }

Property value

ImportedContact

Date property

VB.NET

Public Property Date As Date?

C#

public DateTime? Date { get; set; }

Property value

Nullable<DateTime>

DistList property

Distribution-list payload when Kind is DistributionList, else Nothing.

VB.NET

Public Property DistList As ImportedDistList

C#

public ImportedDistList DistList { get; set; }

Property value

ImportedDistList

FromEmail property

VB.NET

Public Property FromEmail As String

C#

public string FromEmail { get; set; }

Property value

String

FromName property

VB.NET

Public Property FromName As String

C#

public string FromName { get; set; }

Property value

String

Headers property

All raw header name/value pairs, in order.

VB.NET

Public Property Headers As List(Of KeyValuePair(Of String, String))

C#

public List<KeyValuePair<string, string>> Headers { get; set; }

Property value

List<KeyValuePair<String, String>>

Importance property

PidTagImportance: 0 low, 1 normal (default), 2 high.

VB.NET

Public Property Importance As Integer

C#

public int Importance { get; set; }

Property value

Int32

IsRead property

Whether the item is marked read (MSGFLAG_READ). Defaults True; the .msg reader sets it from the file, so an unread message stays unread. Set False to author an unread item.

VB.NET

Public Property IsRead As Boolean

C#

public bool IsRead { get; set; }

Property value

Boolean

Journal property

Journal payload when Kind is Journal, else Nothing.

VB.NET

Public Property Journal As ImportedJournal

C#

public ImportedJournal Journal { get; set; }

Property value

ImportedJournal

Kind property

Item kind: Mail (default), or Appointment / Contact from the ICS / VCF readers. The importer composes the matching Outlook item class.

VB.NET

Public Property Kind As ImportedItemKind

C#

public ImportedItemKind Kind { get; set; }

Property value

ImportedItemKind

MessageClass property

The Outlook message class to write for a ImportedItemKind.Mail item, such as IPM.Note.SMIME or REPORT.IPM.Note.NDR. Empty (the default) writes IPM.Note. The .msg reader sets it from the file, so an item that was not plain mail keeps its class; the other kinds write their own class and ignore this.

VB.NET

Public Property MessageClass As String

C#

public string MessageClass { get; set; }

Property value

String

MessageId property

VB.NET

Public Property MessageId As String

C#

public string MessageId { get; set; }

Property value

String

Note property

Note payload when Kind is Note, else Nothing.

VB.NET

Public Property Note As ImportedNote

C#

public ImportedNote Note { get; set; }

Property value

ImportedNote

Rss property

RSS-post payload when Kind is Rss, else Nothing.

VB.NET

Public Property Rss As ImportedRss

C#

public ImportedRss Rss { get; set; }

Property value

ImportedRss

SourceFolder property

The folder path this item came from (set by readers that carry a folder tree, e.g. the OLM reader). Empty for flat interchange files. Used to place the item on import.

VB.NET

Public Property SourceFolder As String

C#

public string SourceFolder { get; set; }

Property value

String

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Task property

Task payload when Kind is Task, else Nothing.

VB.NET

Public Property Task As ImportedTask

C#

public ImportedTask Task { get; set; }

Property value

ImportedTask

To property

VB.NET

Public Property To As List(Of ImportedAddress)

C#

public List<ImportedAddress> To { get; set; }

Property value

List<ImportedAddress>

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedNote class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Sticky-note fields ([MS-OXONOTE]). The note text is the message BodyText. Color: 0 blue,1 green,2 pink,3 yellow (default),4 white.

VB.NET

Public NotInheritable Class ImportedNote

C#

public sealed class ImportedNote

Constructors

NameDescription
ImportedNote()

Properties

NameDescription
Color
Height
Width

Details

ImportedNote() constructor

VB.NET

Public Sub New()

C#

public ImportedNote();

Color property

VB.NET

Public Property Color As Integer

C#

public int Color { get; set; }

Property value

Int32

Height property

VB.NET

Public Property Height As Integer

C#

public int Height { get; set; }

Property value

Int32

Width property

VB.NET

Public Property Width As Integer

C#

public int Width { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedOccurrenceOverride class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

An override of ONE occurrence of a recurring series ([MS-OXOCAL] ExceptionInfo / ExtendedException): the occurrence generated on OriginalDate is moved and/or re-titled. Members left unset inherit the series value.

VB.NET

Public NotInheritable Class ImportedOccurrenceOverride

C#

public sealed class ImportedOccurrenceOverride

Constructors

NameDescription
ImportedOccurrenceOverride()

Properties

NameDescription
NewBusyStatusNew olBusyStatus (0 free, 1 tentative, 2 busy, 3 OOF). Nothing = unchanged.
NewEndNew end. Nothing = NewStart + the series duration.
NewLocationNew location for this occurrence only. Nothing = unchanged.
NewStartNew start (date + time). Nothing = same day at the series start time.
NewSubjectNew subject for this occurrence only. Nothing = unchanged.
OriginalDateThe day of the generated occurrence being overridden (time is ignored).

Details

ImportedOccurrenceOverride() constructor

VB.NET

Public Sub New()

C#

public ImportedOccurrenceOverride();

NewBusyStatus property

New olBusyStatus (0 free, 1 tentative, 2 busy, 3 OOF). Nothing = unchanged.

VB.NET

Public Property NewBusyStatus As Integer?

C#

public int? NewBusyStatus { get; set; }

Property value

Nullable<Int32>

NewEnd property

New end. Nothing = NewStart + the series duration.

VB.NET

Public Property NewEnd As Date?

C#

public DateTime? NewEnd { get; set; }

Property value

Nullable<DateTime>

NewLocation property

New location for this occurrence only. Nothing = unchanged.

VB.NET

Public Property NewLocation As String

C#

public string NewLocation { get; set; }

Property value

String

NewStart property

New start (date + time). Nothing = same day at the series start time.

VB.NET

Public Property NewStart As Date?

C#

public DateTime? NewStart { get; set; }

Property value

Nullable<DateTime>

NewSubject property

New subject for this occurrence only. Nothing = unchanged.

VB.NET

Public Property NewSubject As String

C#

public string NewSubject { get; set; }

Property value

String

OriginalDate property

The day of the generated occurrence being overridden (time is ignored).

VB.NET

Public Property OriginalDate As Date

C#

public DateTime OriginalDate { get; set; }

Property value

DateTime

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedRecurrence class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Recurrence pattern for an authored or imported appointment ([MS-OXOCAL] 2.2.1.44). The forms Outlook's own model has: daily (every N days), weekly (on selected weekdays, every N weeks), monthly and yearly (on a day of the month, or on the first to fourth or last of a set of weekdays), ending after a count, on a date, or never.

VB.NET

Public NotInheritable Class ImportedRecurrence

C#

public sealed class ImportedRecurrence

Constructors

NameDescription
ImportedRecurrence()

Properties

NameDescription
DayOfMonthFor Monthly and Yearly: day of the month (1–31). A month that has no such day takes its last day, which is Outlook's rule, so 31 means the last day of every month. Ignored when WeekOfMonth is set.
DaysOfWeekFor Weekly: which weekdays the occurrence falls on. For Monthly and Yearly with WeekOfMonth set: the weekdays counted ("the second Tuesday" is Tuesday; Monday to Friday is "the Nth weekday"; all seven is "the Nth day").
EndDateEnd on/after this date (Nothing = count-based or never-ending).
ExcludedDatesOccurrence dates to DELETE from the series (e.g. skip a holiday). Each must fall on a date the pattern would otherwise generate; the day is what matters (time is ignored).
FirstDayOfWeekThe day a week starts on, which decides the weeks of an every-N-weeks series that falls on several days. Sunday unless set.
Frequency
IntervalInterval: every N days / weeks / months / years.
MonthOfYearFor Yearly: the month (1–12). 0 (the default) takes the month of the start.
OccurrenceCountEnd after this many occurrences (0 = use EndDate or run forever).
OverriddenOccurrencesSingle occurrences to OVERRIDE (move / re-title) — [MS-OXOCAL] exceptions. Each must target a date the pattern generates and not one in ExcludedDates.
WeekOfMonthFor Monthly and Yearly: 1 to 4 for the first to fourth of DaysOfWeek in the month, 5 for the last. 0 (the default) means the series falls on DayOfMonth instead.

Details

ImportedRecurrence() constructor

VB.NET

Public Sub New()

C#

public ImportedRecurrence();

DayOfMonth property

For Monthly and Yearly: day of the month (1–31). A month that has no such day takes its last day, which is Outlook's rule, so 31 means the last day of every month. Ignored when WeekOfMonth is set.

VB.NET

Public Property DayOfMonth As Integer

C#

public int DayOfMonth { get; set; }

Property value

Int32

DaysOfWeek property

For Weekly: which weekdays the occurrence falls on. For Monthly and Yearly with WeekOfMonth set: the weekdays counted ("the second Tuesday" is Tuesday; Monday to Friday is "the Nth weekday"; all seven is "the Nth day").

VB.NET

Public Property DaysOfWeek As RecurDays

C#

public RecurDays DaysOfWeek { get; set; }

Property value

RecurDays

EndDate property

End on/after this date (Nothing = count-based or never-ending).

VB.NET

Public Property EndDate As Date?

C#

public DateTime? EndDate { get; set; }

Property value

Nullable<DateTime>

ExcludedDates property

Occurrence dates to DELETE from the series (e.g. skip a holiday). Each must fall on a date the pattern would otherwise generate; the day is what matters (time is ignored).

VB.NET

Public Property ExcludedDates As List(Of Date)

C#

public List<DateTime> ExcludedDates { get; set; }

Property value

List<DateTime>

FirstDayOfWeek property

The day a week starts on, which decides the weeks of an every-N-weeks series that falls on several days. Sunday unless set.

VB.NET

Public Property FirstDayOfWeek As DayOfWeek

C#

public DayOfWeek FirstDayOfWeek { get; set; }

Property value

DayOfWeek

Frequency property

VB.NET

Public Property Frequency As RecurFrequency

C#

public RecurFrequency Frequency { get; set; }

Property value

RecurFrequency

Interval property

Interval: every N days / weeks / months / years.

VB.NET

Public Property Interval As Integer

C#

public int Interval { get; set; }

Property value

Int32

MonthOfYear property

For Yearly: the month (1–12). 0 (the default) takes the month of the start.

VB.NET

Public Property MonthOfYear As Integer

C#

public int MonthOfYear { get; set; }

Property value

Int32

OccurrenceCount property

End after this many occurrences (0 = use EndDate or run forever).

VB.NET

Public Property OccurrenceCount As Integer

C#

public int OccurrenceCount { get; set; }

Property value

Int32

OverriddenOccurrences property

Single occurrences to OVERRIDE (move / re-title) — [MS-OXOCAL] exceptions. Each must target a date the pattern generates and not one in ExcludedDates.

VB.NET

Public Property OverriddenOccurrences As List(Of ImportedOccurrenceOverride)

C#

public List<ImportedOccurrenceOverride> OverriddenOccurrences { get; set; }

Property value

List<ImportedOccurrenceOverride>

WeekOfMonth property

For Monthly and Yearly: 1 to 4 for the first to fourth of DaysOfWeek in the month, 5 for the last. 0 (the default) means the series falls on DayOfMonth instead.

VB.NET

Public Property WeekOfMonth As Integer

C#

public int WeekOfMonth { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedRss class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

RSS post fields ([MS-OXOPOST] / PSETID_PostRss). The article body is the message BodyText/BodyHtml; the channel is the feed the item arrived from.

VB.NET

Public NotInheritable Class ImportedRss

C#

public sealed class ImportedRss

Constructors

NameDescription
ImportedRss()

Properties

NameDescription
ChannelThe channel's display name (PidLidPostRssChannel).
ChannelUrlThe feed's channel URL (PidLidPostRssChannelLink).
ItemGuidThe article's feed-unique id (PidLidPostRssItemGuid).
ItemUrlThe article's own URL (PidLidPostRssItemLink).

Details

ImportedRss() constructor

VB.NET

Public Sub New()

C#

public ImportedRss();

Channel property

The channel's display name (PidLidPostRssChannel).

VB.NET

Public Property Channel As String

C#

public string Channel { get; set; }

Property value

String

ChannelUrl property

The feed's channel URL (PidLidPostRssChannelLink).

VB.NET

Public Property ChannelUrl As String

C#

public string ChannelUrl { get; set; }

Property value

String

ItemGuid property

The article's feed-unique id (PidLidPostRssItemGuid).

VB.NET

Public Property ItemGuid As String

C#

public string ItemGuid { get; set; }

Property value

String

ItemUrl property

The article's own URL (PidLidPostRssItemLink).

VB.NET

Public Property ItemUrl As String

C#

public string ItemUrl { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportedTask class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Task fields ([MS-OXOTASK]). Status 0=not started,1=in progress,2=complete, 3=waiting,4=deferred; PercentComplete is 0..1.

VB.NET

Public NotInheritable Class ImportedTask

C#

public sealed class ImportedTask

Constructors

NameDescription
ImportedTask()

Properties

NameDescription
DateCompleted
DueDate
Owner
PercentComplete
StartDate
Status

Details

ImportedTask() constructor

VB.NET

Public Sub New()

C#

public ImportedTask();

DateCompleted property

VB.NET

Public Property DateCompleted As Date?

C#

public DateTime? DateCompleted { get; set; }

Property value

Nullable<DateTime>

DueDate property

VB.NET

Public Property DueDate As Date?

C#

public DateTime? DueDate { get; set; }

Property value

Nullable<DateTime>

Owner property

VB.NET

Public Property Owner As String

C#

public string Owner { get; set; }

Property value

String

PercentComplete property

VB.NET

Public Property PercentComplete As Double

C#

public double PercentComplete { get; set; }

Property value

Double

StartDate property

VB.NET

Public Property StartDate As Date?

C#

public DateTime? StartDate { get; set; }

Property value

Nullable<DateTime>

Status property

VB.NET

Public Property Status As Integer

C#

public int Status { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportManyResult class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Result of reading a file that can hold many items (an mbox, an .olm archive, an iCalendar or vCard file): the standard error contract, the items read, and how many entries the file held against how many could not be read. The three outcomes a bare collection could not tell apart:

When some entries could be read and some could not, Messages holds the ones that could, the code is ErrorCode.CompletedWithLosses and OperationResult.Losses names each one that could not.

VB.NET

Public NotInheritable Class ImportManyResult
    Inherits OperationResult

C#

public sealed class ImportManyResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
ImportManyResult()

Properties

NameDescription
EntriesFailedEntries that could not be read and are not in Messages.
EntriesSeenEntries the file held: messages in an mbox or .olm, events (and tasks) in an iCalendar file, cards in a vCard file.
MessagesThe items read. Never Nothing.

Methods

NameDescription
ToString()"OK: 12 item(s) read from 14 entries, 2 failed", or the error as "code: description" for any code other than Ok.

Details

ImportManyResult() constructor

VB.NET

Public Sub New()

C#

public ImportManyResult();

EntriesFailed property

Entries that could not be read and are not in Messages.

VB.NET

Public Property EntriesFailed As Integer

C#

public int EntriesFailed { get; set; }

Property value

Int32

EntriesSeen property

Entries the file held: messages in an mbox or .olm, events (and tasks) in an iCalendar file, cards in a vCard file.

VB.NET

Public Property EntriesSeen As Integer

C#

public int EntriesSeen { get; set; }

Property value

Int32

Messages property

The items read. Never Nothing.

VB.NET

Public ReadOnly Property Messages As List(Of ImportedMessage)

C#

public List<ImportedMessage> Messages { get; }

Property value

List<ImportedMessage>

ToString() method

"OK: 12 item(s) read from 14 entries, 2 failed", or the error as "code: description" for any code other than Ok.

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportReport class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Result of an import run: the standard error contract plus counts. A per-file parse failure does not fail the run — it is recorded in Failures and in OperationResult.Losses, the remaining files import normally, and the code is ErrorCode.CompletedWithLosses; the run fails only when NO message could be imported. The counts are of what was written: on a failed run they are zero.

VB.NET

Public NotInheritable Class ImportReport
    Inherits OperationResult

C#

public sealed class ImportReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
ImportReport()

Properties

NameDescription
FailuresOne line per failed input file: "path: reason". For an .olm archive, also one line saying how many of its message entries could not be read.
FilesFailedInput files from which nothing was imported (see Failures). Each is also one LossKind.Source record in OperationResult.Losses.
FilesReadInput files successfully parsed.
FoldersCreatedFolders created to satisfy the target folder path.
MessagesImportedMessages written into the output store.

Methods

NameDescription
ToString()

Details

ImportReport() constructor

VB.NET

Public Sub New()

C#

public ImportReport();

Failures property

One line per failed input file: "path: reason". For an .olm archive, also one line saying how many of its message entries could not be read.

VB.NET

Public ReadOnly Property Failures As List(Of String)

C#

public List<string> Failures { get; }

Property value

List<String>

FilesFailed property

Input files from which nothing was imported (see Failures). Each is also one LossKind.Source record in OperationResult.Losses.

VB.NET

Public Property FilesFailed As Integer

C#

public int FilesFailed { get; set; }

Property value

Int32

FilesRead property

Input files successfully parsed.

VB.NET

Public Property FilesRead As Integer

C#

public int FilesRead { get; set; }

Property value

Int32

FoldersCreated property

Folders created to satisfy the target folder path.

VB.NET

Public Property FoldersCreated As Integer

C#

public int FoldersCreated { get; set; }

Property value

Int32

MessagesImported property

Messages written into the output store.

VB.NET

Public Property MessagesImported As Integer

C#

public int MessagesImported { get; set; }

Property value

Int32

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

ImportResult class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Result of importing a single message: the standard error contract plus the message.

VB.NET

Public NotInheritable Class ImportResult
    Inherits OperationResult

C#

public sealed class ImportResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
ImportResult()

Properties

NameDescription
Message

Details

ImportResult() constructor

VB.NET

Public Sub New()

C#

public ImportResult();

Message property

VB.NET

Public Property Message As ImportedMessage

C#

public ImportedMessage Message { get; set; }

Property value

ImportedMessage

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

MboxReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Reads a Unix mbox file into ImportedMessages. Never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class MboxReader

C#

public sealed class MboxReader

Remarks

A separator is a line that starts From , follows a blank line (or starts the file) and carries a time and a year, as every mbox writer's does. A >From line in a message is restored to From .

Methods

NameDescription
ReadFile(String) staticEnumerate every message in an mbox file, lazily. A message that cannot be parsed is left out, and a file that is missing or is not an mbox gives no messages: use TryReadFile to learn of either. Enumerating does not throw.
TryReadFile(String) staticRead every message in an mbox file and say how it went: the messages, how many the file held, how many could not be parsed, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not an mbox (ErrorCode.InvalidInputFile) from an empty one (Ok, no messages).

Details

ReadFile(String) method static

Enumerate every message in an mbox file, lazily. A message that cannot be parsed is left out, and a file that is missing or is not an mbox gives no messages: use TryReadFile to learn of either. Enumerating does not throw.

VB.NET

Public Shared Function ReadFile(path As String) As IEnumerable(Of ImportedMessage)

C#

public static IEnumerable<ImportedMessage> ReadFile(string path);

Parameters

path String

Returns

IEnumerable<ImportedMessage>

TryReadFile(String) method static

Read every message in an mbox file and say how it went: the messages, how many the file held, how many could not be parsed, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not an mbox (ErrorCode.InvalidInputFile) from an empty one (Ok, no messages).

VB.NET

Public Shared Function TryReadFile(path As String) As ImportManyResult

C#

public static ImportManyResult TryReadFile(string path);

Parameters

path String

Returns

ImportManyResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

MsgReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Parses an Outlook .msg file ([MS-OXMSG] over [MS-CFB]) into a ImportedMessage. Clean-room; validates the container and never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class MsgReader

C#

public sealed class MsgReader

Remarks

The result's code is ErrorCode.FileNotFound for a missing file, ErrorCode.InvalidInputFile for a file that is empty, is not a compound file, is a compound file but not a message, or is cut short where its structure is held, and ErrorCode.CompletedWithLosses when the message was read but part of it could not be (an attachment whose data is cut off, an embedded message that will not open): then ImportResult.Message is set and OperationResult.Losses says what.

The typed fields of ImportedMessage hold the subject, sender, recipients, plain and HTML body, delivery or submit time, read state, importance, attachments and embedded messages, and the message class. Beside them the reader keeps EVERY property the file holds, of the message, of each recipient, of each attachment and of each embedded message, named properties included, and StoreImporter writes them all: a contact keeps its addresses and telephone numbers, an appointment its times and recurrence. A property that a PST item cannot hold, or a named property the file's own name map does not define, is left out and recorded as a loss (LossKind.Property) that lists the property tags.

When a typed field is changed after the file is read, the changed item is written from its typed fields first and the kept properties fill in the rest.

Methods

NameDescription
Parse(Byte[]) staticParse raw .msg bytes into a message model.
ParseFile(String) staticParse a .msg file into a message model.

Details

Parse(Byte[]) method static

Parse raw .msg bytes into a message model.

VB.NET

Public Shared Function Parse(bytes As Byte()) As ImportResult

C#

public static ImportResult Parse(byte[] bytes);

Parameters

bytes Byte[]

Returns

ImportResult

ParseFile(String) method static

Parse a .msg file into a message model.

VB.NET

Public Shared Function ParseFile(path As String) As ImportResult

C#

public static ImportResult ParseFile(string path);

Parameters

path String

Returns

ImportResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

OlmReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Reads Outlook-for-Mac .olm archives (mail items, with folder placement) into the neutral import model. Contacts/calendar/etc. live in separate consolidated XML files and are a later increment; this reads the per-message mail (message_NNNNN.xml).

VB.NET

Public NotInheritable Class OlmReader

C#

public sealed class OlmReader

Methods

NameDescription
ReadFile(String) staticEvery mail message in the .olm, each with its ImportedMessage.SourceFolder set from the archive path. Never throws (a licence refusal aside) and returns what could be read: use TryReadFile to learn whether the file was missing, was not an archive, or held messages or attachments that could not be read.
TryReadFile(String) staticRead every mail message in the .olm and say how it went: the messages, how many message entries the archive held, how many could not be read, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not a readable archive (ErrorCode.InvalidInputFile) from an archive with no mail in it (Ok, no messages).

Details

ReadFile(String) method static

Every mail message in the .olm, each with its ImportedMessage.SourceFolder set from the archive path. Never throws (a licence refusal aside) and returns what could be read: use TryReadFile to learn whether the file was missing, was not an archive, or held messages or attachments that could not be read.

VB.NET

Public Shared Function ReadFile(path As String) As IEnumerable(Of ImportedMessage)

C#

public static IEnumerable<ImportedMessage> ReadFile(string path);

Parameters

path String

Returns

IEnumerable<ImportedMessage>

TryReadFile(String) method static

Read every mail message in the .olm and say how it went: the messages, how many message entries the archive held, how many could not be read, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not a readable archive (ErrorCode.InvalidInputFile) from an archive with no mail in it (Ok, no messages).

VB.NET

Public Shared Function TryReadFile(path As String) As ImportManyResult

C#

public static ImportManyResult TryReadFile(string path);

Parameters

path String

Returns

ImportManyResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

RecurDays enumeration

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Days-of-week bitmask for a weekly recurrence (matches [MS-OXOCAL] PatternTypeWeek).

VB.NET

<Flags>
Public Enum RecurDays

C#

[Flags]
public enum RecurDays

Members

NameValueDescription
None0
Sunday1
Monday2
Tuesday4
Wednesday8
Thursday16
Friday32
Saturday64

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

RecurFrequency enumeration

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Recurrence frequency for an authored or imported appointment.

VB.NET

Public Enum RecurFrequency

C#

public enum RecurFrequency

Members

NameValueDescription
None0
Daily1
Weekly2
Monthly3
Yearly4Every N years, in one month of the year.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

StoreImporter class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Imports EML / MSG / MBOX / ICS / VCF files into a folder of a PST. pstPath is the store to import into (its content is preserved); pass Nothing/empty to start from a new, empty store. The result is always written to outPath — the input store is never modified. Never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class StoreImporter

C#

public sealed class StoreImporter

Methods

NameDescription
CloneStructure(String, String, DiagnosticsContext, Boolean, String) staticCreate a new, EMPTY Unicode PST at outPath that mirrors the folder hierarchy of sourcePath (no messages copied). Returns a ImportReport whose FoldersCreated counts the folders made.
CreateFolders(String, String, String, DiagnosticsContext, Boolean, String) staticCreate an (empty) folder path in pstPath (or a fresh store when empty), writing the result to outPath. Folders already present are left as they are. Returns a ImportReport whose FoldersCreated counts new folders.
ImportFile(String, String, String, String, DiagnosticsContext, Boolean, String) staticImport one file by extension: .msg or .oft, .mbox, .ics (appointments), .vcf (contacts), .eml; a file with any other extension is imported as mail only when its content is a mail message. storeName (optional) sets the name Outlook shows for the store — use it when creating a new store (pstPath = Nothing) to give it a meaningful title.
ImportFiles(String, String, IEnumerable<String>, String, DiagnosticsContext, Boolean, String) staticImport a set of EML / MSG / MBOX / ICS / VCF files into folderPath (created if missing; "/" separates subfolders, relative to the IPM root). storeName (optional) sets the store's display name shown in Outlook.
ImportMbox(String, String, String, String, DiagnosticsContext, Boolean, String) staticImport every message of an mbox file into folderPath, whatever the file is called (a Thunderbird mailbox has no extension). storeName (optional) sets the store's display name shown in Outlook.
ImportMessages(String, String, IEnumerable<ImportedMessage>, String, DiagnosticsContext, Boolean, String) staticImport already-parsed messages (e.g. built or edited in code) into folderPath of the store. storeName (optional) sets the store's display name shown in Outlook.
ImportMessagesByFolder(String, String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, DiagnosticsContext, Boolean, String) staticImport already-parsed messages into MANY folders in a SINGLE atomic rewrite. Each message is placed by its ImportedMessage.SourceFolder, falling back to defaultFolder when that is empty; extraFolders names folders to create that receive no items. Equivalent to one ImportMessages call per folder, except the store is read and rewritten once rather than once per folder — the difference between O(S) and O(S·k) I/O when populating a store with many folders.
ImportOlm(String, String, DiagnosticsContext, Boolean, String) staticImport a Microsoft Outlook for Mac .olm archive into a new PST at outPath, preserving the OLM folder hierarchy. Returns a ImportReport (ErrorCode 0 = success).

Details

CloneStructure(String, String, DiagnosticsContext, Boolean, String) method static

Create a new, EMPTY Unicode PST at outPath that mirrors the folder hierarchy of sourcePath (no messages copied). Returns a ImportReport whose FoldersCreated counts the folders made.

VB.NET

Public Shared Function CloneStructure(
    sourcePath As String,
    outPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport CloneStructure(
    string sourcePath,
    string outPath,
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

sourcePath String
outPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

Remarks

A folder of the source whose list of subfolders cannot be read fails the call (ErrorCode.InvalidPstFormat, nothing written) unless DiagnosticsContext.RecoverFromCorruption is set; then the folders that could be read are mirrored and the result is ErrorCode.CompletedWithLosses. It used to return Ok with part of the tree.

CreateFolders(String, String, String, DiagnosticsContext, Boolean, String) method static

Create an (empty) folder path in pstPath (or a fresh store when empty), writing the result to outPath. Folders already present are left as they are. Returns a ImportReport whose FoldersCreated counts new folders.

VB.NET

Public Shared Function CreateFolders(
    pstPath As String,
    outPath As String,
    folderPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = True,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport CreateFolders(
    string pstPath,
    string outPath,
    string folderPath,
    DiagnosticsContext diag = null,
    bool overwrite = true,
    string storeName = null
);

Parameters

pstPath String
outPath String
folderPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

ImportFile(String, String, String, String, DiagnosticsContext, Boolean, String) method static

Import one file by extension: .msg or .oft, .mbox, .ics (appointments), .vcf (contacts), .eml; a file with any other extension is imported as mail only when its content is a mail message. storeName (optional) sets the name Outlook shows for the store — use it when creating a new store (pstPath = Nothing) to give it a meaningful title.

VB.NET

Public Shared Function ImportFile(
    pstPath As String,
    outPath As String,
    filePath As String,
    Optional folderPath As String = "Imported",
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport ImportFile(
    string pstPath,
    string outPath,
    string filePath,
    string folderPath = "Imported",
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

pstPath String
outPath String
filePath String
folderPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

ImportFiles(String, String, IEnumerable<String>, String, DiagnosticsContext, Boolean, String) method static

Import a set of EML / MSG / MBOX / ICS / VCF files into folderPath (created if missing; "/" separates subfolders, relative to the IPM root). storeName (optional) sets the store's display name shown in Outlook.

VB.NET

Public Shared Function ImportFiles(
    pstPath As String,
    outPath As String,
    files As IEnumerable(Of String),
    Optional folderPath As String = "Imported",
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport ImportFiles(
    string pstPath,
    string outPath,
    IEnumerable<string> files,
    string folderPath = "Imported",
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

pstPath String
outPath String
files IEnumerable<String>
folderPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

Remarks

Each file is imported on its own. One that cannot be read at all does not stop the run: it is counted in ImportReport.FilesFailed, listed in ImportReport.Failures and recorded as one loss (LossKind.Source, with the file's path), the other files are imported, and the result is ErrorCode.CompletedWithLosses with the output written. Damage inside a file that was read (an attachment that would not decode, a date that could not be read, an entry of an mbox that would not parse) is recorded the same way and the rest of that file is imported. This is so whether or not DiagnosticsContext.RecoverFromCorruption is set: that switch is about a damaged PST or OST, here the store being imported INTO.

When nothing at all could be imported nothing is written, and the code is ErrorCode.InvalidInputFile (the files were unreadable) or ErrorCode.InvalidArgument (no file was given).

ImportMbox(String, String, String, String, DiagnosticsContext, Boolean, String) method static

Import every message of an mbox file into folderPath, whatever the file is called (a Thunderbird mailbox has no extension). storeName (optional) sets the store's display name shown in Outlook.

VB.NET

Public Shared Function ImportMbox(
    pstPath As String,
    outPath As String,
    mboxPath As String,
    Optional folderPath As String = "Imported",
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport ImportMbox(
    string pstPath,
    string outPath,
    string mboxPath,
    string folderPath = "Imported",
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

pstPath String
outPath String
mboxPath String
folderPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

ImportMessages(String, String, IEnumerable<ImportedMessage>, String, DiagnosticsContext, Boolean, String) method static

Import already-parsed messages (e.g. built or edited in code) into folderPath of the store. storeName (optional) sets the store's display name shown in Outlook.

VB.NET

Public Shared Function ImportMessages(
    pstPath As String,
    outPath As String,
    messages As IEnumerable(Of ImportedMessage),
    Optional folderPath As String = "Imported",
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport ImportMessages(
    string pstPath,
    string outPath,
    IEnumerable<ImportedMessage> messages,
    string folderPath = "Imported",
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

pstPath String
outPath String
messages IEnumerable<ImportedMessage>
folderPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

ImportMessagesByFolder(String, String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, DiagnosticsContext, Boolean, String) method static

Import already-parsed messages into MANY folders in a SINGLE atomic rewrite. Each message is placed by its ImportedMessage.SourceFolder, falling back to defaultFolder when that is empty; extraFolders names folders to create that receive no items. Equivalent to one ImportMessages call per folder, except the store is read and rewritten once rather than once per folder — the difference between O(S) and O(S·k) I/O when populating a store with many folders.

VB.NET

Public Shared Function ImportMessagesByFolder(
    pstPath As String,
    outPath As String,
    messages As IEnumerable(Of ImportedMessage),
    Optional defaultFolder As String = "Imported",
    Optional extraFolders As IEnumerable(Of String) = Nothing,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport ImportMessagesByFolder(
    string pstPath,
    string outPath,
    IEnumerable<ImportedMessage> messages,
    string defaultFolder = "Imported",
    IEnumerable<string> extraFolders = null,
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

pstPath String
outPath String
messages IEnumerable<ImportedMessage>
defaultFolder String
extraFolders IEnumerable<String>
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

ImportOlm(String, String, DiagnosticsContext, Boolean, String) method static

Import a Microsoft Outlook for Mac .olm archive into a new PST at outPath, preserving the OLM folder hierarchy. Returns a ImportReport (ErrorCode 0 = success).

VB.NET

Public Shared Function ImportOlm(
    olmPath As String,
    outPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional storeName As String = Nothing
) As ImportReport

C#

public static ImportReport ImportOlm(
    string olmPath,
    string outPath,
    DiagnosticsContext diag = null,
    bool overwrite = false,
    string storeName = null
);

Parameters

olmPath String
outPath String
diag DiagnosticsContext
overwrite Boolean
storeName String

Returns

ImportReport

Remarks

A message entry of the archive that cannot be read, and an attachment whose file is missing from it, are each a recorded loss; the rest is imported and the result is ErrorCode.CompletedWithLosses. When the archive holds mail for more than one account, each account's folders are placed under a folder named for the account. An archive from which no message could be read is ErrorCode.InvalidInputFile and nothing is written.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

TnefReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Decodes TNEF (winmail.dat) streams into real attachments ([MS-OXTNEF]). Tolerant of damage; never throws into the caller (a licence refusal aside).

VB.NET

Public NotInheritable Class TnefReader

C#

public sealed class TnefReader

Remarks

The result's code is ErrorCode.FileNotFound for a missing file, ErrorCode.InvalidInputFile for data that is not a TNEF stream, and ErrorCode.CompletedWithLosses when the stream was read but was damaged (truncated, a failed checksum, an attachment with no data, a property list cut short): what was recovered is returned and OperationResult.Losses says what was not.

Methods

NameDescription
IsTnef(Byte[]) staticTrue when the buffer starts with the TNEF signature.
Parse(Byte[]) staticDecode a TNEF stream. Damage is tolerated: unreadable tails are dropped, checksum mismatches are counted, and everything recoverable is returned.
ParseFile(String) staticDecode a TNEF file (e.g. a saved winmail.dat).

Fields

NameDescription
Signature staticThe TNEF stream signature ([MS-OXTNEF] 2.1.3.1).

Details

IsTnef(Byte[]) method static

True when the buffer starts with the TNEF signature.

VB.NET

Public Shared Function IsTnef(data As Byte()) As Boolean

C#

public static bool IsTnef(byte[] data);

Parameters

data Byte[]

Returns

Boolean

Parse(Byte[]) method static

Decode a TNEF stream. Damage is tolerated: unreadable tails are dropped, checksum mismatches are counted, and everything recoverable is returned.

VB.NET

Public Shared Function Parse(data As Byte()) As TnefResult

C#

public static TnefResult Parse(byte[] data);

Parameters

data Byte[]

Returns

TnefResult

ParseFile(String) method static

Decode a TNEF file (e.g. a saved winmail.dat).

VB.NET

Public Shared Function ParseFile(path As String) As TnefResult

C#

public static TnefResult ParseFile(string path);

Parameters

path String

Returns

TnefResult

Signature field static

The TNEF stream signature ([MS-OXTNEF] 2.1.3.1).

VB.NET

Public Const Signature As UInteger = 574529400

C#

public const uint Signature = 574529400;

Field value

UInt32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

TnefResult class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Result of decoding a TNEF stream: the standard error contract, the recovered attachments and bodies, plus damage counters (bad checksums / truncated attributes).

VB.NET

Public NotInheritable Class TnefResult
    Inherits OperationResult

C#

public sealed class TnefResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
TnefResult()

Properties

NameDescription
AttachmentsThe real attachments recovered from the TNEF stream.
AttachmentsWithoutDataAttachments the stream declared but gave no data for. Each is still in Attachments, by name and empty, so that it is seen to be missing; they used to be left out without a count.
AttributesReadAttributes successfully walked.
BodyHtmlHTML body carried in the MAPI property list (PidTagBodyHtml), if any.
BodyTextPlain-text body carried in attBody, if any.
ChecksumErrorsAttributes whose 16-bit checksum did not match (content still used).
PropertyListsIncompleteMAPI property lists that could not be read to their end. Names, MIME types or content taken from such a list may be missing.
TruncatedTrue when the stream ended mid-attribute (truncated file); everything recovered up to that point is still returned.

Methods

NameDescription
ToString()

Details

TnefResult() constructor

VB.NET

Public Sub New()

C#

public TnefResult();

Attachments property

The real attachments recovered from the TNEF stream.

VB.NET

Public ReadOnly Property Attachments As List(Of ImportedAttachment)

C#

public List<ImportedAttachment> Attachments { get; }

Property value

List<ImportedAttachment>

AttachmentsWithoutData property

Attachments the stream declared but gave no data for. Each is still in Attachments, by name and empty, so that it is seen to be missing; they used to be left out without a count.

VB.NET

Public Property AttachmentsWithoutData As Integer

C#

public int AttachmentsWithoutData { get; set; }

Property value

Int32

AttributesRead property

Attributes successfully walked.

VB.NET

Public Property AttributesRead As Integer

C#

public int AttributesRead { get; set; }

Property value

Int32

BodyHtml property

HTML body carried in the MAPI property list (PidTagBodyHtml), if any.

VB.NET

Public Property BodyHtml As String

C#

public string BodyHtml { get; set; }

Property value

String

BodyText property

Plain-text body carried in attBody, if any.

VB.NET

Public Property BodyText As String

C#

public string BodyText { get; set; }

Property value

String

ChecksumErrors property

Attributes whose 16-bit checksum did not match (content still used).

VB.NET

Public Property ChecksumErrors As Integer

C#

public int ChecksumErrors { get; set; }

Property value

Int32

PropertyListsIncomplete property

MAPI property lists that could not be read to their end. Names, MIME types or content taken from such a list may be missing.

VB.NET

Public Property PropertyListsIncomplete As Integer

C#

public int PropertyListsIncomplete { get; set; }

Property value

Int32

Truncated property

True when the stream ended mid-attribute (truncated file); everything recovered up to that point is still returned.

VB.NET

Public Property Truncated As Boolean

C#

public bool Truncated { get; set; }

Property value

Boolean

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace

VcfReader class

Namespace: Bastion.Pst.Import · Assembly: Bastion.Pst.dll

Reads a vCard (.vcf) file: yields each card as a contact-kind ImportedMessage. Malformed cards are skipped; never throws (a licence refusal aside).

VB.NET

Public NotInheritable Class VcfReader

C#

public sealed class VcfReader

Methods

NameDescription
Parse(String) staticParse vCard text: one imported contact per BEGIN:VCARD…END:VCARD block. Never throws (a licence refusal aside); text that holds no card gives an empty list.
ReadFile(String) staticEnumerate every vCard in a .vcf file as an imported contact. Never throws (a licence refusal aside) and returns what could be read: use TryReadFile to learn whether the file was missing, was not a vCard file, or held cards that were left out.
TryReadFile(String) staticRead every vCard in a .vcf file and say how it went: the contacts, how many cards the file held, how many were left out, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not a vCard file (ErrorCode.InvalidInputFile) from one with no cards (Ok, no messages).

Details

Parse(String) method static

Parse vCard text: one imported contact per BEGIN:VCARD…END:VCARD block. Never throws (a licence refusal aside); text that holds no card gives an empty list.

VB.NET

Public Shared Function Parse(text As String) As List(Of ImportedMessage)

C#

public static List<ImportedMessage> Parse(string text);

Parameters

text String

Returns

List<ImportedMessage>

ReadFile(String) method static

Enumerate every vCard in a .vcf file as an imported contact. Never throws (a licence refusal aside) and returns what could be read: use TryReadFile to learn whether the file was missing, was not a vCard file, or held cards that were left out.

VB.NET

Public Shared Function ReadFile(path As String) As IEnumerable(Of ImportedMessage)

C#

public static IEnumerable<ImportedMessage> ReadFile(string path);

Parameters

path String

Returns

IEnumerable<ImportedMessage>

TryReadFile(String) method static

Read every vCard in a .vcf file and say how it went: the contacts, how many cards the file held, how many were left out, and an error code that tells a missing file (ErrorCode.FileNotFound) from one that is not a vCard file (ErrorCode.InvalidInputFile) from one with no cards (Ok, no messages).

VB.NET

Public Shared Function TryReadFile(path As String) As ImportManyResult

C#

public static ImportManyResult TryReadFile(string path);

Parameters

path String

Returns

ImportManyResult

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Messaging namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
AppointmentItem
AppointmentRecurrenceThe recurrence pattern of a recurring appointment: how often it recurs, on which days, until when, and which occurrences were deleted or changed. Read-only; get it from AppointmentItem.Recurrence.
Attachment
ContactItem
DistListMemberOne member of a distribution list: who they are, and where mail to them goes.
DistributionListItem
FolderA folder of an opened store: its properties, its subfolders and its items.
FolderClassThe standard PidTagContainerClass values — what tells a host application that a folder holds appointments rather than mail. Pass one of these to Author.SetFolderClass, or compare against Folder.ContainerClass.
Item
JournalItem
MailItem
MessageQuery
ModifiedOccurrenceOne occurrence of a recurring appointment that was changed on its own: moved to another time, or given its own subject or location.
NoteItem
OpenResultResult of PersonalStorage.TryOpen: ErrorCode 0 = opened, Store usable.
PersonalStorageAn opened PST or OST file: the way in to its folders and items.
PstMessageA message or other item (contact, appointment, task, note) of an opened store.
Recipient
SearchEngineWalks a folder subtree applying a MessageQuery.
SearchHitA search result: the message and the folder path it was found in.
TaskItem

Interfaces

NameDescription
IAppointmentItemAppointment / meeting — [MS-OXOCAL].
IContactItemContact — [MS-OXOCNTC].
IDistributionListItemDistribution list — [MS-OXOABK] / [MS-OXODLGT].
IItemCommon projection shared by every typed item.
IJournalItemJournal entry — [MS-OXOJRNL].
IMailItemMail message — [MS-OXOMSG].
INoteItemSticky note — [MS-OXONOTE]. The note text is IItem.Body.
ITaskItemTask — [MS-OXOTASK].

Enumerations

NameDescription
AttachMethodPidTagAttachMethod (0x3705) — how an attachment's data is stored.
BusyStatusPidLidBusyStatus (PSETID_Appointment 0x8205) — free/busy for an appointment.
ImportancePidTagImportance (0x0017).
ItemKindThe kind of MAPI item, derived from PidTagMessageClass.
RecipientTypePidTagRecipientType (0x0C15) — the role of a recipient on a message.
RecurrenceEndKindHow a recurring series ends.
SensitivityPidTagSensitivity (0x0036).
TaskStatusPidLidTaskStatus (PSETID_Task 0x8101).

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

AppointmentItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class AppointmentItem
    Inherits Item
    Implements IAppointmentItem

C#

public sealed class AppointmentItem : Item, IAppointmentItem

Inherits: Item

Implements: IAppointmentItem

Properties

NameDescription
AllAttendees
Attendees
BusyStatus
DurationMinutes
EndTime
IsAllDay
IsRecurring
Location
RecurrenceThe recurrence pattern of a recurring appointment: how often it recurs, on which days, until when, in which time zone, and which occurrences were deleted or changed; AppointmentRecurrence.Occurrences gives the instants in a window of time. Nothing when the appointment does not recur, and also when its pattern cannot be read or is of a kind that cannot be described (a non-Gregorian calendar): RecurrenceUnreadableReason then says why. Never throws.
RecurrenceUnreadableReasonWhy Recurrence is Nothing for an appointment that IsRecurring, in words; Nothing when the recurrence was read, or the appointment does not recur.
ReminderMinutesBeforeStart
ReminderSet
StartTime

Details

AllAttendees property

VB.NET

Public ReadOnly Property AllAttendees As String

C#

public string AllAttendees { get; }

Property value

String

Attendees property

VB.NET

Public ReadOnly Property Attendees As IReadOnlyList(Of Recipient)

C#

public IReadOnlyList<Recipient> Attendees { get; }

Property value

IReadOnlyList<Recipient>

BusyStatus property

VB.NET

Public ReadOnly Property BusyStatus As BusyStatus

C#

public BusyStatus BusyStatus { get; }

Property value

BusyStatus

DurationMinutes property

VB.NET

Public ReadOnly Property DurationMinutes As Integer

C#

public int DurationMinutes { get; }

Property value

Int32

EndTime property

VB.NET

Public ReadOnly Property EndTime As Date?

C#

public DateTime? EndTime { get; }

Property value

Nullable<DateTime>

IsAllDay property

VB.NET

Public ReadOnly Property IsAllDay As Boolean

C#

public bool IsAllDay { get; }

Property value

Boolean

IsRecurring property

VB.NET

Public ReadOnly Property IsRecurring As Boolean

C#

public bool IsRecurring { get; }

Property value

Boolean

Location property

VB.NET

Public ReadOnly Property Location As String

C#

public string Location { get; }

Property value

String

Recurrence property

The recurrence pattern of a recurring appointment: how often it recurs, on which days, until when, in which time zone, and which occurrences were deleted or changed; AppointmentRecurrence.Occurrences gives the instants in a window of time. Nothing when the appointment does not recur, and also when its pattern cannot be read or is of a kind that cannot be described (a non-Gregorian calendar): RecurrenceUnreadableReason then says why. Never throws.

VB.NET

Public ReadOnly Property Recurrence As AppointmentRecurrence

C#

public AppointmentRecurrence Recurrence { get; }

Property value

AppointmentRecurrence

Remarks

For a recurring appointment StartTime and EndTime are those of the FIRST occurrence.

RecurrenceUnreadableReason property

Why Recurrence is Nothing for an appointment that IsRecurring, in words; Nothing when the recurrence was read, or the appointment does not recur.

VB.NET

Public ReadOnly Property RecurrenceUnreadableReason As String

C#

public string RecurrenceUnreadableReason { get; }

Property value

String

ReminderMinutesBeforeStart property

VB.NET

Public ReadOnly Property ReminderMinutesBeforeStart As Integer

C#

public int ReminderMinutesBeforeStart { get; }

Property value

Int32

ReminderSet property

VB.NET

Public ReadOnly Property ReminderSet As Boolean

C#

public bool ReminderSet { get; }

Property value

Boolean

StartTime property

VB.NET

Public ReadOnly Property StartTime As Date?

C#

public DateTime? StartTime { get; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

AppointmentRecurrence class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

The recurrence pattern of a recurring appointment: how often it recurs, on which days, until when, and which occurrences were deleted or changed. Read-only; get it from AppointmentItem.Recurrence.

VB.NET

Public NotInheritable Class AppointmentRecurrence

C#

public sealed class AppointmentRecurrence

Remarks

A series recurs at a fixed time on the clock of ONE time zone (a weekly meeting at 09:00 in London stays at 09:00 there when the clocks change). The days in this description are days on that zone's calendar. Occurrences gives the instants.

Properties

NameDescription
DayOfMonthFor a monthly or yearly series on a day of the month: that day (1 to 31; a month without it takes its last day). 0 when the series is weekly or daily, or falls on a weekday of the month (WeekOfMonth).
DaysOfWeekFor a weekly series: the days of the week it falls on. For a monthly or yearly series with WeekOfMonth set: the days counted ("the second Tuesday" is Tuesday; Monday to Friday is "the Nth weekday"). Otherwise None.
DeletedOccurrencesThe days of occurrences that were deleted from the series, in order: days on the series' own calendar, at midnight, of no Kind.
DurationMinutesHow long each occurrence lasts, in minutes.
EndDateThe last day the series can fall on, at midnight on its own calendar, when it ends on a date. Nothing otherwise.
EndKindWhether the series ends, and how.
FirstStartUtcThe first occurrence's start (UTC), as the pattern has it.
FrequencyDaily, weekly, monthly or yearly.
IntervalEvery how many days, weeks, months or years (1 or more).
ModifiedOccurrencesThe occurrences that were changed on their own (moved, or given their own subject or location), in order of the day the pattern put them on.
MonthOfYearFor a yearly series: the month (1 to 12). 0 otherwise.
OccurrenceCountThe number of occurrences the pattern makes, when the series ends after a count (deleted occurrences are counted: the count is the pattern's, not what is left of it). 0 otherwise.
TimeZoneDescriptionThe description of the time zone stored with the series, as whoever wrote the item gave it; Nothing when none is stored.
TimeZoneIdThe Windows id of the time zone the series recurs in ("GMT Standard Time"), when the item stores one; Nothing when it does not. An item with no time zone stored at all is read on this computer's clock, as Outlook reads it.
WeekOfMonthFor a monthly or yearly series on a weekday of the month: 1 to 4 for the first to fourth of DaysOfWeek, 5 for the last. 0 otherwise.

Methods

NameDescription
Occurrences(DateTime, DateTime)The start of every occurrence that begins in a window of time, in order, as UTC instants. Deleted occurrences are left out; a changed occurrence is given at the time it was moved to.

Fields

NameDescription
MaxOccurrencesPerWindow staticThe most occurrences Occurrences returns for one window.

Details

DayOfMonth property

For a monthly or yearly series on a day of the month: that day (1 to 31; a month without it takes its last day). 0 when the series is weekly or daily, or falls on a weekday of the month (WeekOfMonth).

VB.NET

Public ReadOnly Property DayOfMonth As Integer

C#

public int DayOfMonth { get; }

Property value

Int32

DaysOfWeek property

For a weekly series: the days of the week it falls on. For a monthly or yearly series with WeekOfMonth set: the days counted ("the second Tuesday" is Tuesday; Monday to Friday is "the Nth weekday"). Otherwise None.

VB.NET

Public ReadOnly Property DaysOfWeek As RecurDays

C#

public RecurDays DaysOfWeek { get; }

Property value

RecurDays

DeletedOccurrences property

The days of occurrences that were deleted from the series, in order: days on the series' own calendar, at midnight, of no Kind.

VB.NET

Public ReadOnly Property DeletedOccurrences As IReadOnlyList(Of Date)

C#

public IReadOnlyList<DateTime> DeletedOccurrences { get; }

Property value

IReadOnlyList<DateTime>

DurationMinutes property

How long each occurrence lasts, in minutes.

VB.NET

Public ReadOnly Property DurationMinutes As Integer

C#

public int DurationMinutes { get; }

Property value

Int32

EndDate property

The last day the series can fall on, at midnight on its own calendar, when it ends on a date. Nothing otherwise.

VB.NET

Public ReadOnly Property EndDate As Date?

C#

public DateTime? EndDate { get; }

Property value

Nullable<DateTime>

EndKind property

Whether the series ends, and how.

VB.NET

Public ReadOnly Property EndKind As RecurrenceEndKind

C#

public RecurrenceEndKind EndKind { get; }

Property value

RecurrenceEndKind

FirstStartUtc property

The first occurrence's start (UTC), as the pattern has it.

VB.NET

Public ReadOnly Property FirstStartUtc As Date

C#

public DateTime FirstStartUtc { get; }

Property value

DateTime

Frequency property

Daily, weekly, monthly or yearly.

VB.NET

Public ReadOnly Property Frequency As RecurFrequency

C#

public RecurFrequency Frequency { get; }

Property value

RecurFrequency

Interval property

Every how many days, weeks, months or years (1 or more).

VB.NET

Public ReadOnly Property Interval As Integer

C#

public int Interval { get; }

Property value

Int32

ModifiedOccurrences property

The occurrences that were changed on their own (moved, or given their own subject or location), in order of the day the pattern put them on.

VB.NET

Public ReadOnly Property ModifiedOccurrences As IReadOnlyList(Of ModifiedOccurrence)

C#

public IReadOnlyList<ModifiedOccurrence> ModifiedOccurrences { get; }

Property value

IReadOnlyList<ModifiedOccurrence>

MonthOfYear property

For a yearly series: the month (1 to 12). 0 otherwise.

VB.NET

Public ReadOnly Property MonthOfYear As Integer

C#

public int MonthOfYear { get; }

Property value

Int32

OccurrenceCount property

The number of occurrences the pattern makes, when the series ends after a count (deleted occurrences are counted: the count is the pattern's, not what is left of it). 0 otherwise.

VB.NET

Public ReadOnly Property OccurrenceCount As Integer

C#

public int OccurrenceCount { get; }

Property value

Int32

TimeZoneDescription property

The description of the time zone stored with the series, as whoever wrote the item gave it; Nothing when none is stored.

VB.NET

Public ReadOnly Property TimeZoneDescription As String

C#

public string TimeZoneDescription { get; }

Property value

String

TimeZoneId property

The Windows id of the time zone the series recurs in ("GMT Standard Time"), when the item stores one; Nothing when it does not. An item with no time zone stored at all is read on this computer's clock, as Outlook reads it.

VB.NET

Public ReadOnly Property TimeZoneId As String

C#

public string TimeZoneId { get; }

Property value

String

WeekOfMonth property

For a monthly or yearly series on a weekday of the month: 1 to 4 for the first to fourth of DaysOfWeek, 5 for the last. 0 otherwise.

VB.NET

Public ReadOnly Property WeekOfMonth As Integer

C#

public int WeekOfMonth { get; }

Property value

Int32

Occurrences(DateTime, DateTime) method

The start of every occurrence that begins in a window of time, in order, as UTC instants. Deleted occurrences are left out; a changed occurrence is given at the time it was moved to.

VB.NET

Public Function Occurrences(fromUtc As Date, toUtc As Date) As IReadOnlyList(Of Date)

C#

public IReadOnlyList<DateTime> Occurrences(DateTime fromUtc, DateTime toUtc);

Parameters

fromUtc DateTime
The start of the window (included). A Date of no kind is taken as UTC.
toUtc DateTime
The end of the window (excluded).

Returns

IReadOnlyList<DateTime>

Exceptions

ExceptionCondition
ArgumentExceptionThe window ends before it starts, or holds more than MaxOccurrencesPerWindow occurrences: ask for a shorter one.

MaxOccurrencesPerWindow field static

The most occurrences Occurrences returns for one window.

VB.NET

Public Const MaxOccurrencesPerWindow As Integer = 10000

C#

public const int MaxOccurrencesPerWindow = 10000;

Field value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

Attachment class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class Attachment

C#

public sealed class Attachment

Properties

NameDescription
ContentIdContent id of an attachment referenced from the HTML body as cid:… — an inline image. A host rendering the HTML needs this to resolve those references, and a reading pane should list such an attachment in the body rather than as a paperclip. Empty for an ordinary attached file.
FileNameBest file name: long name, then short (8.3) name, then display name.
IsEmbeddedMessage
Method
MimeTag
Size

Methods

NameDescription
GetData()The attachment's bytes for afByValue attachments (PidTagAttachDataBinary); Nothing for by-reference or embedded-message attachments.
GetEmbeddedMessage()The embedded message of an afEmbeddedMessage attachment, or Nothing when this attachment is not an embedded message. PidTagAttachDataObject holds an 8-byte {subnode NID, size} record ([MS-PST] 2.4.6.2); the message lives in that subnode of the attachment's own subtree, complete with its recipient/attachment tables (which may nest further embedded messages).
ToString()

Details

ContentId property

Content id of an attachment referenced from the HTML body as cid:… — an inline image. A host rendering the HTML needs this to resolve those references, and a reading pane should list such an attachment in the body rather than as a paperclip. Empty for an ordinary attached file.

VB.NET

Public ReadOnly Property ContentId As String

C#

public string ContentId { get; }

Property value

String

FileName property

Best file name: long name, then short (8.3) name, then display name.

VB.NET

Public ReadOnly Property FileName As String

C#

public string FileName { get; }

Property value

String

IsEmbeddedMessage property

VB.NET

Public ReadOnly Property IsEmbeddedMessage As Boolean

C#

public bool IsEmbeddedMessage { get; }

Property value

Boolean

Method property

VB.NET

Public ReadOnly Property Method As AttachMethod

C#

public AttachMethod Method { get; }

Property value

AttachMethod

MimeTag property

VB.NET

Public ReadOnly Property MimeTag As String

C#

public string MimeTag { get; }

Property value

String

Size property

VB.NET

Public ReadOnly Property Size As Integer

C#

public int Size { get; }

Property value

Int32

GetData() method

The attachment's bytes for afByValue attachments (PidTagAttachDataBinary); Nothing for by-reference or embedded-message attachments.

VB.NET

Public Function GetData() As Byte()

C#

public byte[] GetData();

Returns

Byte[]

GetEmbeddedMessage() method

The embedded message of an afEmbeddedMessage attachment, or Nothing when this attachment is not an embedded message. PidTagAttachDataObject holds an 8-byte {subnode NID, size} record ([MS-PST] 2.4.6.2); the message lives in that subnode of the attachment's own subtree, complete with its recipient/attachment tables (which may nest further embedded messages).

VB.NET

Public Function GetEmbeddedMessage() As PstMessage

C#

public PstMessage GetEmbeddedMessage();

Returns

PstMessage

Exceptions

ExceptionCondition
InvalidDataExceptionThe embedded message cannot be read and the running operation is not recovering from damage.

Remarks

Nothing used to mean "not an embedded message" AND "an embedded message that could not be read", so an export wrote the outer message without its attached e-mail and reported success. An embedded message that cannot be read now fails an operation that is not recovering; otherwise the loss is recorded (or raised as PstEvents.PstError when no operation is running) and Nothing is returned.

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

AttachMethod enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

PidTagAttachMethod (0x3705) — how an attachment's data is stored.

VB.NET

Public Enum AttachMethod

C#

public enum AttachMethod

Members

NameValueDescription
None0
ByValue1
ByReference2
ByReferenceResolve3
ByReferenceOnly4
EmbeddedMessage5
Storage6

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

BusyStatus enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

PidLidBusyStatus (PSETID_Appointment 0x8205) — free/busy for an appointment.

VB.NET

Public Enum BusyStatus

C#

public enum BusyStatus

Members

NameValueDescription
Free0
Tentative1
Busy2
OutOfOffice3
WorkingElsewhere4

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

ContactItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class ContactItem
    Inherits Item
    Implements IContactItem

C#

public sealed class ContactItem : Item, IContactItem

Inherits: Item

Implements: IContactItem

Properties

NameDescription
AnniversaryThe contact's wedding anniversary, at midnight (a calendar day, as Birthday). Nothing when none is recorded.
BirthdayThe contact's birthday, at midnight (a calendar day: its Kind is Unspecified). Nothing when none is recorded.
BusinessAddress
BusinessFax
BusinessTelephone
CompanyName
Department
DisplayName
Email1Address
Email1DisplayName
Email2Address
Email3Address
FileUnder
GivenName
HomeAddress
HomeTelephone
JobTitle
MiddleName
MobileTelephone
Nickname
OfficeLocation
Surname
WebPage

Details

Anniversary property

The contact's wedding anniversary, at midnight (a calendar day, as Birthday). Nothing when none is recorded.

VB.NET

Public ReadOnly Property Anniversary As Date?

C#

public DateTime? Anniversary { get; }

Property value

Nullable<DateTime>

Birthday property

The contact's birthday, at midnight (a calendar day: its Kind is Unspecified). Nothing when none is recorded.

VB.NET

Public ReadOnly Property Birthday As Date?

C#

public DateTime? Birthday { get; }

Property value

Nullable<DateTime>

BusinessAddress property

VB.NET

Public ReadOnly Property BusinessAddress As String

C#

public string BusinessAddress { get; }

Property value

String

BusinessFax property

VB.NET

Public ReadOnly Property BusinessFax As String

C#

public string BusinessFax { get; }

Property value

String

BusinessTelephone property

VB.NET

Public ReadOnly Property BusinessTelephone As String

C#

public string BusinessTelephone { get; }

Property value

String

CompanyName property

VB.NET

Public ReadOnly Property CompanyName As String

C#

public string CompanyName { get; }

Property value

String

Department property

VB.NET

Public ReadOnly Property Department As String

C#

public string Department { get; }

Property value

String

DisplayName property

VB.NET

Public ReadOnly Property DisplayName As String

C#

public string DisplayName { get; }

Property value

String

Email1Address property

VB.NET

Public ReadOnly Property Email1Address As String

C#

public string Email1Address { get; }

Property value

String

Email1DisplayName property

VB.NET

Public ReadOnly Property Email1DisplayName As String

C#

public string Email1DisplayName { get; }

Property value

String

Email2Address property

VB.NET

Public ReadOnly Property Email2Address As String

C#

public string Email2Address { get; }

Property value

String

Email3Address property

VB.NET

Public ReadOnly Property Email3Address As String

C#

public string Email3Address { get; }

Property value

String

FileUnder property

VB.NET

Public ReadOnly Property FileUnder As String

C#

public string FileUnder { get; }

Property value

String

GivenName property

VB.NET

Public ReadOnly Property GivenName As String

C#

public string GivenName { get; }

Property value

String

HomeAddress property

VB.NET

Public ReadOnly Property HomeAddress As String

C#

public string HomeAddress { get; }

Property value

String

HomeTelephone property

VB.NET

Public ReadOnly Property HomeTelephone As String

C#

public string HomeTelephone { get; }

Property value

String

JobTitle property

VB.NET

Public ReadOnly Property JobTitle As String

C#

public string JobTitle { get; }

Property value

String

MiddleName property

VB.NET

Public ReadOnly Property MiddleName As String

C#

public string MiddleName { get; }

Property value

String

MobileTelephone property

VB.NET

Public ReadOnly Property MobileTelephone As String

C#

public string MobileTelephone { get; }

Property value

String

Nickname property

VB.NET

Public ReadOnly Property Nickname As String

C#

public string Nickname { get; }

Property value

String

OfficeLocation property

VB.NET

Public ReadOnly Property OfficeLocation As String

C#

public string OfficeLocation { get; }

Property value

String

Surname property

VB.NET

Public ReadOnly Property Surname As String

C#

public string Surname { get; }

Property value

String

WebPage property

VB.NET

Public ReadOnly Property WebPage As String

C#

public string WebPage { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

DistListMember class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

One member of a distribution list: who they are, and where mail to them goes.

VB.NET

Public NotInheritable Class DistListMember

C#

public sealed class DistListMember

Constructors

NameDescription
DistListMember()

Properties

NameDescription
Address
AddressType
DisplayName

Methods

NameDescription
ToString()What a list shows: the name, falling back to the address.

Details

DistListMember() constructor

VB.NET

Public Sub New()

C#

public DistListMember();

Address property

VB.NET

Public Property Address As String

C#

public string Address { get; set; }

Property value

String

AddressType property

VB.NET

Public Property AddressType As String

C#

public string AddressType { get; set; }

Property value

String

DisplayName property

VB.NET

Public Property DisplayName As String

C#

public string DisplayName { get; set; }

Property value

String

ToString() method

What a list shows: the name, falling back to the address.

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

DistributionListItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class DistributionListItem
    Inherits Item
    Implements IDistributionListItem

C#

public sealed class DistributionListItem : Item, IDistributionListItem

Inherits: Item

Implements: IDistributionListItem

Properties

NameDescription
MemberCountMember count from PidLidDistributionListMembers — a PtypMultipleBinary whose value begins with a 4-byte element count ([MS-OXCDATA] 2.11.1.5). 0 if absent.
MembersWho is actually in the list. Without this a group is only ever a name and a number, which is why hosts drew it as an empty contact card — there was nothing else to show. Each member is a One-Off EntryID ([MS-OXCDATA] 2.2.5.1) inside the multi-valued binary; an unreadable element is skipped rather than taking the whole list down.
MembersUnreadableHow many members the list declares that Members could not return: an element that lies outside the stored value, or one that is not a readable one-off address. Members skips those so one bad element does not cost the whole list, which left a caller no way to know the list it was shown was short. Zero means every declared member was returned.
Name

Details

MemberCount property

Member count from PidLidDistributionListMembers — a PtypMultipleBinary whose value begins with a 4-byte element count ([MS-OXCDATA] 2.11.1.5). 0 if absent.

VB.NET

Public ReadOnly Property MemberCount As Integer

C#

public int MemberCount { get; }

Property value

Int32

Members property

Who is actually in the list. Without this a group is only ever a name and a number, which is why hosts drew it as an empty contact card — there was nothing else to show. Each member is a One-Off EntryID ([MS-OXCDATA] 2.2.5.1) inside the multi-valued binary; an unreadable element is skipped rather than taking the whole list down.

VB.NET

Public ReadOnly Property Members As List(Of DistListMember)

C#

public List<DistListMember> Members { get; }

Property value

List<DistListMember>

MembersUnreadable property

How many members the list declares that Members could not return: an element that lies outside the stored value, or one that is not a readable one-off address. Members skips those so one bad element does not cost the whole list, which left a caller no way to know the list it was shown was short. Zero means every declared member was returned.

VB.NET

Public ReadOnly Property MembersUnreadable As Integer

C#

public int MembersUnreadable { get; }

Property value

Int32

Name property

VB.NET

Public ReadOnly Property Name As String

C#

public string Name { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

Folder class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

A folder of an opened store: its properties, its subfolders and its items.

VB.NET

Public NotInheritable Class Folder

C#

public sealed class Folder

Remarks

Property getters (DisplayName, ContentCount and the rest) read the folder's own record and throw InvalidDataException or KeyNotFoundException when that record is damaged or missing. They do not return an error code; PersonalStorage.TryOpen is the result-returning way to open a file, and the operations that return an OperationResult are the way to process one without handling exceptions.

SubFolders, Messages and AssociatedMessages do not throw for a damaged table when called by a host: see UnreadableTable.

Properties

NameDescription
ContainerClassThe folder's container class (PidTagContainerClass) — "IPF.Note", "IPF.Appointment", "IPF.Contact", "IPF.Task", "IPF.StickyNote", "IPF.Journal", … — how a host app tells a calendar folder from a mail folder. Empty when unset (an unset class is conventionally treated as mail).
ContentCount
DisplayName
HasSubfolders
UnreadableTableTrue when a table read for this folder failed and was tolerated — the folder reported fewer rows (possibly none) than it really holds. Tolerating a broken table keeps a damaged store walkable, but it makes "this folder is empty" and "this folder could not be read" look identical to a caller, which turns corruption into plausible-looking data. A host that lists folders should check this (or compare against ContentCount) and tell the user the folder is damaged rather than silently showing it as empty. It is set on THIS object, by enumerating it: SubFolders and PersonalStorage.RootFolder hand out a new object each time, so ask the one you enumerated, after enumerating it. PersonalStorage.UnreadableFolderTables keeps the count for the whole store, and PstEvents.PstError is raised for each failure.
UnreadCount

Methods

NameDescription
AssociatedMessages()Folder-associated (FAI) messages, from the FAI Contents Table.
Messages()Messages, from the Contents Table (empty if none). Lazy — each opens on access.
OpenMessage(UInt32)Reopen a message in this store by its PstMessage.NodeId — the host pattern for resolving full detail (body, recipients, attachments) of a row it listed earlier without holding the whole message graph in memory.
Search(MessageQuery)Search this folder and its subfolders for messages matching query.
SubFolders()Subfolders, from the Hierarchy Table (empty if none).
ToString()Never throws: a debugger, a log line or a list box calls this on whatever it is given, and a damaged folder must not take that down.

Details

ContainerClass property

The folder's container class (PidTagContainerClass) — "IPF.Note", "IPF.Appointment", "IPF.Contact", "IPF.Task", "IPF.StickyNote", "IPF.Journal", … — how a host app tells a calendar folder from a mail folder. Empty when unset (an unset class is conventionally treated as mail).

VB.NET

Public ReadOnly Property ContainerClass As String

C#

public string ContainerClass { get; }

Property value

String

ContentCount property

VB.NET

Public ReadOnly Property ContentCount As Integer

C#

public int ContentCount { get; }

Property value

Int32

DisplayName property

VB.NET

Public ReadOnly Property DisplayName As String

C#

public string DisplayName { get; }

Property value

String

HasSubfolders property

VB.NET

Public ReadOnly Property HasSubfolders As Boolean

C#

public bool HasSubfolders { get; }

Property value

Boolean

UnreadableTable property

True when a table read for this folder failed and was tolerated — the folder reported fewer rows (possibly none) than it really holds. Tolerating a broken table keeps a damaged store walkable, but it makes "this folder is empty" and "this folder could not be read" look identical to a caller, which turns corruption into plausible-looking data. A host that lists folders should check this (or compare against ContentCount) and tell the user the folder is damaged rather than silently showing it as empty. It is set on THIS object, by enumerating it: SubFolders and PersonalStorage.RootFolder hand out a new object each time, so ask the one you enumerated, after enumerating it. PersonalStorage.UnreadableFolderTables keeps the count for the whole store, and PstEvents.PstError is raised for each failure.

VB.NET

Public ReadOnly Property UnreadableTable As Boolean

C#

public bool UnreadableTable { get; }

Property value

Boolean

UnreadCount property

VB.NET

Public ReadOnly Property UnreadCount As Integer

C#

public int UnreadCount { get; }

Property value

Int32

AssociatedMessages() method

Folder-associated (FAI) messages, from the FAI Contents Table.

VB.NET

Public Function AssociatedMessages() As IEnumerable(Of PstMessage)

C#

public IEnumerable<PstMessage> AssociatedMessages();

Returns

IEnumerable<PstMessage>

Messages() method

Messages, from the Contents Table (empty if none). Lazy — each opens on access.

VB.NET

Public Function Messages() As IEnumerable(Of PstMessage)

C#

public IEnumerable<PstMessage> Messages();

Returns

IEnumerable<PstMessage>

OpenMessage(UInt32) method

Reopen a message in this store by its PstMessage.NodeId — the host pattern for resolving full detail (body, recipients, attachments) of a row it listed earlier without holding the whole message graph in memory.

VB.NET

Public Function OpenMessage(nodeId As UInteger) As PstMessage

C#

public PstMessage OpenMessage(uint nodeId);

Parameters

nodeId UInt32

Returns

PstMessage

SubFolders() method

Subfolders, from the Hierarchy Table (empty if none).

VB.NET

Public Function SubFolders() As IEnumerable(Of Folder)

C#

public IEnumerable<Folder> SubFolders();

Returns

IEnumerable<Folder>

ToString() method

Never throws: a debugger, a log line or a list box calls this on whatever it is given, and a damaged folder must not take that down.

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

FolderClass class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

The standard PidTagContainerClass values — what tells a host application that a folder holds appointments rather than mail. Pass one of these to Author.SetFolderClass, or compare against Folder.ContainerClass.

VB.NET

Public NotInheritable Class FolderClass

C#

public sealed class FolderClass

Remarks

An unset (empty) container class is conventionally treated as mail, so a mail folder does not strictly need Mail stamped on it.

The class is inherited by subfolders in practice: every folder under a Calendar is usually Appointment too. It therefore identifies a folder's KIND, not its identity — two sibling folders can legitimately share one.

Fields

NameDescription
Appointment staticCalendar items — "IPF.Appointment".
Birthday staticThe birthday calendar Outlook maintains — "IPF.Appointment.Birthday".
Contact staticContacts — "IPF.Contact".
Homepage staticA folder homepage — "IPF.Note.OutlookHomepage".
Journal staticJournal entries — "IPF.Journal".
Mail staticMail and post items — "IPF.Note". The default for a new folder.
StickyNote staticSticky notes — "IPF.StickyNote".
Task staticTasks — "IPF.Task".

Details

Appointment field static

Calendar items — "IPF.Appointment".

VB.NET

Public Const Appointment As String = "IPF.Appointment"

C#

public const string Appointment = "IPF.Appointment";

Field value

String

Birthday field static

The birthday calendar Outlook maintains — "IPF.Appointment.Birthday".

VB.NET

Public Const Birthday As String = "IPF.Appointment.Birthday"

C#

public const string Birthday = "IPF.Appointment.Birthday";

Field value

String

Contact field static

Contacts — "IPF.Contact".

VB.NET

Public Const Contact As String = "IPF.Contact"

C#

public const string Contact = "IPF.Contact";

Field value

String

Homepage field static

A folder homepage — "IPF.Note.OutlookHomepage".

VB.NET

Public Const Homepage As String = "IPF.Note.OutlookHomepage"

C#

public const string Homepage = "IPF.Note.OutlookHomepage";

Field value

String

Journal field static

Journal entries — "IPF.Journal".

VB.NET

Public Const Journal As String = "IPF.Journal"

C#

public const string Journal = "IPF.Journal";

Field value

String

Mail field static

Mail and post items — "IPF.Note". The default for a new folder.

VB.NET

Public Const Mail As String = "IPF.Note"

C#

public const string Mail = "IPF.Note";

Field value

String

StickyNote field static

Sticky notes — "IPF.StickyNote".

VB.NET

Public Const StickyNote As String = "IPF.StickyNote"

C#

public const string StickyNote = "IPF.StickyNote";

Field value

String

Task field static

Tasks — "IPF.Task".

VB.NET

Public Const Task As String = "IPF.Task"

C#

public const string Task = "IPF.Task";

Field value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

IAppointmentItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Appointment / meeting — [MS-OXOCAL].

VB.NET

Public Interface IAppointmentItem
    Inherits IItem

C#

public interface IAppointmentItem : IItem

Inherits: IItem

Properties

NameDescription
AllAttendees
AttendeesMeeting attendees (the message recipients).
BusyStatus
DurationMinutes
EndTime
IsAllDay
IsRecurring
Location
ReminderMinutesBeforeStart
ReminderSet
StartTime

Details

AllAttendees property

VB.NET

ReadOnly Property AllAttendees As String

C#

string AllAttendees { get; }

Property value

String

Attendees property

Meeting attendees (the message recipients).

VB.NET

ReadOnly Property Attendees As IReadOnlyList(Of Recipient)

C#

IReadOnlyList<Recipient> Attendees { get; }

Property value

IReadOnlyList<Recipient>

BusyStatus property

VB.NET

ReadOnly Property BusyStatus As BusyStatus

C#

BusyStatus BusyStatus { get; }

Property value

BusyStatus

DurationMinutes property

VB.NET

ReadOnly Property DurationMinutes As Integer

C#

int DurationMinutes { get; }

Property value

Int32

EndTime property

VB.NET

ReadOnly Property EndTime As Date?

C#

DateTime? EndTime { get; }

Property value

Nullable<DateTime>

IsAllDay property

VB.NET

ReadOnly Property IsAllDay As Boolean

C#

bool IsAllDay { get; }

Property value

Boolean

IsRecurring property

VB.NET

ReadOnly Property IsRecurring As Boolean

C#

bool IsRecurring { get; }

Property value

Boolean

Location property

VB.NET

ReadOnly Property Location As String

C#

string Location { get; }

Property value

String

ReminderMinutesBeforeStart property

VB.NET

ReadOnly Property ReminderMinutesBeforeStart As Integer

C#

int ReminderMinutesBeforeStart { get; }

Property value

Int32

ReminderSet property

VB.NET

ReadOnly Property ReminderSet As Boolean

C#

bool ReminderSet { get; }

Property value

Boolean

StartTime property

VB.NET

ReadOnly Property StartTime As Date?

C#

DateTime? StartTime { get; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

IContactItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Contact — [MS-OXOCNTC].

VB.NET

Public Interface IContactItem
    Inherits IItem

C#

public interface IContactItem : IItem

Inherits: IItem

Properties

NameDescription
Anniversary
Birthday
BusinessAddressComposed mailing (business) address.
BusinessFax
BusinessTelephone
CompanyName
Department
DisplayName
Email1Address
Email1DisplayName
Email2Address
Email3Address
FileUnder
GivenName
HomeAddressComposed home address.
HomeTelephone
JobTitle
MiddleName
MobileTelephone
Nickname
OfficeLocation
Surname
WebPage

Details

Anniversary property

VB.NET

ReadOnly Property Anniversary As Date?

C#

DateTime? Anniversary { get; }

Property value

Nullable<DateTime>

Birthday property

VB.NET

ReadOnly Property Birthday As Date?

C#

DateTime? Birthday { get; }

Property value

Nullable<DateTime>

BusinessAddress property

Composed mailing (business) address.

VB.NET

ReadOnly Property BusinessAddress As String

C#

string BusinessAddress { get; }

Property value

String

BusinessFax property

VB.NET

ReadOnly Property BusinessFax As String

C#

string BusinessFax { get; }

Property value

String

BusinessTelephone property

VB.NET

ReadOnly Property BusinessTelephone As String

C#

string BusinessTelephone { get; }

Property value

String

CompanyName property

VB.NET

ReadOnly Property CompanyName As String

C#

string CompanyName { get; }

Property value

String

Department property

VB.NET

ReadOnly Property Department As String

C#

string Department { get; }

Property value

String

DisplayName property

VB.NET

ReadOnly Property DisplayName As String

C#

string DisplayName { get; }

Property value

String

Email1Address property

VB.NET

ReadOnly Property Email1Address As String

C#

string Email1Address { get; }

Property value

String

Email1DisplayName property

VB.NET

ReadOnly Property Email1DisplayName As String

C#

string Email1DisplayName { get; }

Property value

String

Email2Address property

VB.NET

ReadOnly Property Email2Address As String

C#

string Email2Address { get; }

Property value

String

Email3Address property

VB.NET

ReadOnly Property Email3Address As String

C#

string Email3Address { get; }

Property value

String

FileUnder property

VB.NET

ReadOnly Property FileUnder As String

C#

string FileUnder { get; }

Property value

String

GivenName property

VB.NET

ReadOnly Property GivenName As String

C#

string GivenName { get; }

Property value

String

HomeAddress property

Composed home address.

VB.NET

ReadOnly Property HomeAddress As String

C#

string HomeAddress { get; }

Property value

String

HomeTelephone property

VB.NET

ReadOnly Property HomeTelephone As String

C#

string HomeTelephone { get; }

Property value

String

JobTitle property

VB.NET

ReadOnly Property JobTitle As String

C#

string JobTitle { get; }

Property value

String

MiddleName property

VB.NET

ReadOnly Property MiddleName As String

C#

string MiddleName { get; }

Property value

String

MobileTelephone property

VB.NET

ReadOnly Property MobileTelephone As String

C#

string MobileTelephone { get; }

Property value

String

Nickname property

VB.NET

ReadOnly Property Nickname As String

C#

string Nickname { get; }

Property value

String

OfficeLocation property

VB.NET

ReadOnly Property OfficeLocation As String

C#

string OfficeLocation { get; }

Property value

String

Surname property

VB.NET

ReadOnly Property Surname As String

C#

string Surname { get; }

Property value

String

WebPage property

VB.NET

ReadOnly Property WebPage As String

C#

string WebPage { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

IDistributionListItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Distribution list — [MS-OXOABK] / [MS-OXODLGT].

VB.NET

Public Interface IDistributionListItem
    Inherits IItem

C#

public interface IDistributionListItem : IItem

Inherits: IItem

Properties

NameDescription
MemberCountNumber of members (count from PidLidDistributionListMembers); 0 if absent.
MembersThe members themselves — name and address apiece. Empty when the list carries no readable member property.
Name

Details

MemberCount property

Number of members (count from PidLidDistributionListMembers); 0 if absent.

VB.NET

ReadOnly Property MemberCount As Integer

C#

int MemberCount { get; }

Property value

Int32

Members property

The members themselves — name and address apiece. Empty when the list carries no readable member property.

VB.NET

ReadOnly Property Members As List(Of DistListMember)

C#

List<DistListMember> Members { get; }

Property value

List<DistListMember>

Name property

VB.NET

ReadOnly Property Name As String

C#

string Name { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

IItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Common projection shared by every typed item.

VB.NET

Public Interface IItem

C#

public interface IItem

Properties

NameDescription
BodyPlain-text body (PidTagBody).
CreationTime
KindItem kind from PidTagMessageClass.
LastModificationTime
MessageThe underlying raw message (escape hatch to the full PC / named props).
MessageClassPidTagMessageClass verbatim (e.g. "IPM.Appointment").
Subject

Details

Body property

Plain-text body (PidTagBody).

VB.NET

ReadOnly Property Body As String

C#

string Body { get; }

Property value

String

CreationTime property

VB.NET

ReadOnly Property CreationTime As Date?

C#

DateTime? CreationTime { get; }

Property value

Nullable<DateTime>

Kind property

Item kind from PidTagMessageClass.

VB.NET

ReadOnly Property Kind As ItemKind

C#

ItemKind Kind { get; }

Property value

ItemKind

LastModificationTime property

VB.NET

ReadOnly Property LastModificationTime As Date?

C#

DateTime? LastModificationTime { get; }

Property value

Nullable<DateTime>

Message property

The underlying raw message (escape hatch to the full PC / named props).

VB.NET

ReadOnly Property Message As PstMessage

C#

PstMessage Message { get; }

Property value

PstMessage

MessageClass property

PidTagMessageClass verbatim (e.g. "IPM.Appointment").

VB.NET

ReadOnly Property MessageClass As String

C#

string MessageClass { get; }

Property value

String

Subject property

VB.NET

ReadOnly Property Subject As String

C#

string Subject { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

IJournalItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Journal entry — [MS-OXOJRNL].

VB.NET

Public Interface IJournalItem
    Inherits IItem

C#

public interface IJournalItem : IItem

Inherits: IItem

Properties

NameDescription
DurationMinutes
EndTime
JournalType
StartTime

Details

DurationMinutes property

VB.NET

ReadOnly Property DurationMinutes As Integer

C#

int DurationMinutes { get; }

Property value

Int32

EndTime property

VB.NET

ReadOnly Property EndTime As Date?

C#

DateTime? EndTime { get; }

Property value

Nullable<DateTime>

JournalType property

VB.NET

ReadOnly Property JournalType As String

C#

string JournalType { get; }

Property value

String

StartTime property

VB.NET

ReadOnly Property StartTime As Date?

C#

DateTime? StartTime { get; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

IMailItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Mail message — [MS-OXOMSG].

VB.NET

Public Interface IMailItem
    Inherits IItem

C#

public interface IMailItem : IItem

Inherits: IItem

Properties

NameDescription
Attachments
BodyHtml
ConversationTopic
DeliveryTime
DisplayBcc
DisplayCc
DisplayTo
HasAttachments
Importance
InternetMessageId
IsHtmlFormatTrue when the message was written as HTML — i.e. it should be rendered as HTML rather than shown as text. False for a plain-text message.
IsUnread
Recipients
SenderEmail
SenderName
Sensitivity
SubmitTime

Details

Attachments property

VB.NET

ReadOnly Property Attachments As IReadOnlyList(Of Attachment)

C#

IReadOnlyList<Attachment> Attachments { get; }

Property value

IReadOnlyList<Attachment>

BodyHtml property

VB.NET

ReadOnly Property BodyHtml As String

C#

string BodyHtml { get; }

Property value

String

ConversationTopic property

VB.NET

ReadOnly Property ConversationTopic As String

C#

string ConversationTopic { get; }

Property value

String

DeliveryTime property

VB.NET

ReadOnly Property DeliveryTime As Date?

C#

DateTime? DeliveryTime { get; }

Property value

Nullable<DateTime>

DisplayBcc property

VB.NET

ReadOnly Property DisplayBcc As String

C#

string DisplayBcc { get; }

Property value

String

DisplayCc property

VB.NET

ReadOnly Property DisplayCc As String

C#

string DisplayCc { get; }

Property value

String

DisplayTo property

VB.NET

ReadOnly Property DisplayTo As String

C#

string DisplayTo { get; }

Property value

String

HasAttachments property

VB.NET

ReadOnly Property HasAttachments As Boolean

C#

bool HasAttachments { get; }

Property value

Boolean

Importance property

VB.NET

ReadOnly Property Importance As Importance

C#

Importance Importance { get; }

Property value

Importance

InternetMessageId property

VB.NET

ReadOnly Property InternetMessageId As String

C#

string InternetMessageId { get; }

Property value

String

IsHtmlFormat property

True when the message was written as HTML — i.e. it should be rendered as HTML rather than shown as text. False for a plain-text message.

VB.NET

ReadOnly Property IsHtmlFormat As Boolean

C#

bool IsHtmlFormat { get; }

Property value

Boolean

IsUnread property

VB.NET

ReadOnly Property IsUnread As Boolean

C#

bool IsUnread { get; }

Property value

Boolean

Recipients property

VB.NET

ReadOnly Property Recipients As IReadOnlyList(Of Recipient)

C#

IReadOnlyList<Recipient> Recipients { get; }

Property value

IReadOnlyList<Recipient>

SenderEmail property

VB.NET

ReadOnly Property SenderEmail As String

C#

string SenderEmail { get; }

Property value

String

SenderName property

VB.NET

ReadOnly Property SenderName As String

C#

string SenderName { get; }

Property value

String

Sensitivity property

VB.NET

ReadOnly Property Sensitivity As Sensitivity

C#

Sensitivity Sensitivity { get; }

Property value

Sensitivity

SubmitTime property

VB.NET

ReadOnly Property SubmitTime As Date?

C#

DateTime? SubmitTime { get; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

Importance enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

PidTagImportance (0x0017).

VB.NET

Public Enum Importance

C#

public enum Importance

Members

NameValueDescription
Low0
Normal1
High2

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

INoteItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Sticky note — [MS-OXONOTE]. The note text is IItem.Body.

VB.NET

Public Interface INoteItem
    Inherits IItem

C#

public interface INoteItem : IItem

Inherits: IItem

Properties

NameDescription
ColorPidLidNoteColor (0=blue,1=green,2=pink,3=yellow,4=white).
Height
Width

Details

Color property

PidLidNoteColor (0=blue,1=green,2=pink,3=yellow,4=white).

VB.NET

ReadOnly Property Color As Integer

C#

int Color { get; }

Property value

Int32

Height property

VB.NET

ReadOnly Property Height As Integer

C#

int Height { get; }

Property value

Int32

Width property

VB.NET

ReadOnly Property Width As Integer

C#

int Width { get; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

ITaskItem interface

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Task — [MS-OXOTASK].

VB.NET

Public Interface ITaskItem
    Inherits IItem

C#

public interface ITaskItem : IItem

Inherits: IItem

Properties

NameDescription
DateCompleted
DueDate
Importance
IsComplete
Owner
PercentCompleteFraction complete, 0.0 .. 1.0.
StartDate
Status

Details

DateCompleted property

VB.NET

ReadOnly Property DateCompleted As Date?

C#

DateTime? DateCompleted { get; }

Property value

Nullable<DateTime>

DueDate property

VB.NET

ReadOnly Property DueDate As Date?

C#

DateTime? DueDate { get; }

Property value

Nullable<DateTime>

Importance property

VB.NET

ReadOnly Property Importance As Importance

C#

Importance Importance { get; }

Property value

Importance

IsComplete property

VB.NET

ReadOnly Property IsComplete As Boolean

C#

bool IsComplete { get; }

Property value

Boolean

Owner property

VB.NET

ReadOnly Property Owner As String

C#

string Owner { get; }

Property value

String

PercentComplete property

Fraction complete, 0.0 .. 1.0.

VB.NET

ReadOnly Property PercentComplete As Double

C#

double PercentComplete { get; }

Property value

Double

StartDate property

VB.NET

ReadOnly Property StartDate As Date?

C#

DateTime? StartDate { get; }

Property value

Nullable<DateTime>

Status property

VB.NET

ReadOnly Property Status As TaskStatus

C#

TaskStatus Status { get; }

Property value

TaskStatus

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

Item class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public MustInherit Class Item
    Implements IItem

C#

public abstract class Item : IItem

Implements: IItem

Derived: AppointmentItem, ContactItem, DistributionListItem, JournalItem, MailItem, NoteItem, TaskItem

Properties

NameDescription
Body
CreationTime
Kind
LastModificationTime
Message
MessageClass
Subject

Methods

NameDescription
Wrap(PstMessage) staticWrap a message in the typed interface matching its PidTagMessageClass. Always returns a usable item; an unrecognised class is projected as a mail item (the MAPI base item class).

Details

Body property

VB.NET

Public ReadOnly Property Body As String

C#

public string Body { get; }

Property value

String

CreationTime property

VB.NET

Public ReadOnly Property CreationTime As Date?

C#

public DateTime? CreationTime { get; }

Property value

Nullable<DateTime>

Kind property

VB.NET

Public ReadOnly Property Kind As ItemKind

C#

public ItemKind Kind { get; }

Property value

ItemKind

LastModificationTime property

VB.NET

Public ReadOnly Property LastModificationTime As Date?

C#

public DateTime? LastModificationTime { get; }

Property value

Nullable<DateTime>

Message property

VB.NET

Public ReadOnly Property Message As PstMessage

C#

public PstMessage Message { get; }

Property value

PstMessage

MessageClass property

VB.NET

Public ReadOnly Property MessageClass As String

C#

public string MessageClass { get; }

Property value

String

Subject property

VB.NET

Public ReadOnly Property Subject As String

C#

public string Subject { get; }

Property value

String

Wrap(PstMessage) method static

Wrap a message in the typed interface matching its PidTagMessageClass. Always returns a usable item; an unrecognised class is projected as a mail item (the MAPI base item class).

VB.NET

Public Shared Function Wrap(msg As PstMessage) As IItem

C#

public static IItem Wrap(PstMessage msg);

Parameters

msg PstMessage

Returns

IItem

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

ItemKind enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

The kind of MAPI item, derived from PidTagMessageClass.

VB.NET

Public Enum ItemKind

C#

public enum ItemKind

Members

NameValueDescription
Unknown0
Mail1
Appointment2
Contact3
Task4
Note5
Journal6
DistributionList7

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

JournalItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class JournalItem
    Inherits Item
    Implements IJournalItem

C#

public sealed class JournalItem : Item, IJournalItem

Inherits: Item

Implements: IJournalItem

Properties

NameDescription
DurationMinutes
EndTime
JournalType
StartTime

Details

DurationMinutes property

VB.NET

Public ReadOnly Property DurationMinutes As Integer

C#

public int DurationMinutes { get; }

Property value

Int32

EndTime property

VB.NET

Public ReadOnly Property EndTime As Date?

C#

public DateTime? EndTime { get; }

Property value

Nullable<DateTime>

JournalType property

VB.NET

Public ReadOnly Property JournalType As String

C#

public string JournalType { get; }

Property value

String

StartTime property

VB.NET

Public ReadOnly Property StartTime As Date?

C#

public DateTime? StartTime { get; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

MailItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class MailItem
    Inherits Item
    Implements IMailItem

C#

public sealed class MailItem : Item, IMailItem

Inherits: Item

Implements: IMailItem

Properties

NameDescription
Attachments
BodyHtmlThe message's HTML body, or "" when it has none. PidTagBodyHtml is usually stored as BINARY, not as a string — so reading it as a string returned nothing for almost every HTML message ever sent, and hosts fell back to showing the plain-text alternative (a wall of bracketed URLs) as if the message had no HTML at all. The bytes are decoded with the message's own code page (PidTagInternetCodepage), falling back to the charset declared in the HTML itself, then to Windows-1252 — the encoding most untagged mail actually uses.
ConversationTopic
DeliveryTime
DisplayBcc
DisplayCc
DisplayTo
HasAttachments
Importance
InternetMessageId
IsHtmlFormatTrue when this message is an HTML message. Checks the body form the message declares (PidTagNativeBody) and, failing that, whether an HTML body is actually present — a host should not have to fetch and measure the body just to decide how to render it.
IsUnread
Recipients
SenderEmail
SenderName
Sensitivity
SubmitTime

Details

Attachments property

VB.NET

Public ReadOnly Property Attachments As IReadOnlyList(Of Attachment)

C#

public IReadOnlyList<Attachment> Attachments { get; }

Property value

IReadOnlyList<Attachment>

BodyHtml property

The message's HTML body, or "" when it has none. PidTagBodyHtml is usually stored as BINARY, not as a string — so reading it as a string returned nothing for almost every HTML message ever sent, and hosts fell back to showing the plain-text alternative (a wall of bracketed URLs) as if the message had no HTML at all. The bytes are decoded with the message's own code page (PidTagInternetCodepage), falling back to the charset declared in the HTML itself, then to Windows-1252 — the encoding most untagged mail actually uses.

VB.NET

Public ReadOnly Property BodyHtml As String

C#

public string BodyHtml { get; }

Property value

String

ConversationTopic property

VB.NET

Public ReadOnly Property ConversationTopic As String

C#

public string ConversationTopic { get; }

Property value

String

DeliveryTime property

VB.NET

Public ReadOnly Property DeliveryTime As Date?

C#

public DateTime? DeliveryTime { get; }

Property value

Nullable<DateTime>

DisplayBcc property

VB.NET

Public ReadOnly Property DisplayBcc As String

C#

public string DisplayBcc { get; }

Property value

String

DisplayCc property

VB.NET

Public ReadOnly Property DisplayCc As String

C#

public string DisplayCc { get; }

Property value

String

DisplayTo property

VB.NET

Public ReadOnly Property DisplayTo As String

C#

public string DisplayTo { get; }

Property value

String

HasAttachments property

VB.NET

Public ReadOnly Property HasAttachments As Boolean

C#

public bool HasAttachments { get; }

Property value

Boolean

Importance property

VB.NET

Public ReadOnly Property Importance As Importance

C#

public Importance Importance { get; }

Property value

Importance

InternetMessageId property

VB.NET

Public ReadOnly Property InternetMessageId As String

C#

public string InternetMessageId { get; }

Property value

String

IsHtmlFormat property

True when this message is an HTML message. Checks the body form the message declares (PidTagNativeBody) and, failing that, whether an HTML body is actually present — a host should not have to fetch and measure the body just to decide how to render it.

VB.NET

Public ReadOnly Property IsHtmlFormat As Boolean

C#

public bool IsHtmlFormat { get; }

Property value

Boolean

IsUnread property

VB.NET

Public ReadOnly Property IsUnread As Boolean

C#

public bool IsUnread { get; }

Property value

Boolean

Recipients property

VB.NET

Public ReadOnly Property Recipients As IReadOnlyList(Of Recipient)

C#

public IReadOnlyList<Recipient> Recipients { get; }

Property value

IReadOnlyList<Recipient>

SenderEmail property

VB.NET

Public ReadOnly Property SenderEmail As String

C#

public string SenderEmail { get; }

Property value

String

SenderName property

VB.NET

Public ReadOnly Property SenderName As String

C#

public string SenderName { get; }

Property value

String

Sensitivity property

VB.NET

Public ReadOnly Property Sensitivity As Sensitivity

C#

public Sensitivity Sensitivity { get; }

Property value

Sensitivity

SubmitTime property

VB.NET

Public ReadOnly Property SubmitTime As Date?

C#

public DateTime? SubmitTime { get; }

Property value

Nullable<DateTime>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

MessageQuery class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class MessageQuery

C#

public sealed class MessageQuery

Constructors

NameDescription
MessageQuery()

Methods

NameDescription
HasClass(String)Message class starts with prefix (e.g. "IPM.Note").
HasMessageId(String)
ImportanceAtLeast(Int32)
LargerThan(Int32)
Matches(PstMessage)True when the message satisfies every criterion (empty query matches all).
OfKind(ItemKind)
RecipientContains(String)
SenderContains(String)
SubjectContains(String)
Unread()
Where(Func<PstMessage, Boolean>)Add an arbitrary criterion.
WithAttachments(Boolean)

Details

MessageQuery() constructor

VB.NET

Public Sub New()

C#

public MessageQuery();

HasClass(String) method

Message class starts with prefix (e.g. "IPM.Note").

VB.NET

Public Function HasClass(prefix As String) As MessageQuery

C#

public MessageQuery HasClass(string prefix);

Parameters

prefix String

Returns

MessageQuery

HasMessageId(String) method

VB.NET

Public Function HasMessageId(id As String) As MessageQuery

C#

public MessageQuery HasMessageId(string id);

Parameters

id String

Returns

MessageQuery

ImportanceAtLeast(Int32) method

VB.NET

Public Function ImportanceAtLeast(level As Integer) As MessageQuery

C#

public MessageQuery ImportanceAtLeast(int level);

Parameters

level Int32

Returns

MessageQuery

LargerThan(Int32) method

VB.NET

Public Function LargerThan(bytes As Integer) As MessageQuery

C#

public MessageQuery LargerThan(int bytes);

Parameters

bytes Int32

Returns

MessageQuery

Matches(PstMessage) method

True when the message satisfies every criterion (empty query matches all).

VB.NET

Public Function Matches(msg As PstMessage) As Boolean

C#

public bool Matches(PstMessage msg);

Parameters

msg PstMessage

Returns

Boolean

OfKind(ItemKind) method

VB.NET

Public Function OfKind(kind As ItemKind) As MessageQuery

C#

public MessageQuery OfKind(ItemKind kind);

Parameters

kind ItemKind

Returns

MessageQuery

RecipientContains(String) method

VB.NET

Public Function RecipientContains(text As String) As MessageQuery

C#

public MessageQuery RecipientContains(string text);

Parameters

text String

Returns

MessageQuery

SenderContains(String) method

VB.NET

Public Function SenderContains(text As String) As MessageQuery

C#

public MessageQuery SenderContains(string text);

Parameters

text String

Returns

MessageQuery

SubjectContains(String) method

VB.NET

Public Function SubjectContains(text As String) As MessageQuery

C#

public MessageQuery SubjectContains(string text);

Parameters

text String

Returns

MessageQuery

Unread() method

VB.NET

Public Function Unread() As MessageQuery

C#

public MessageQuery Unread();

Returns

MessageQuery

Where(Func<PstMessage, Boolean>) method

Add an arbitrary criterion.

VB.NET

Public Function Where(predicate As Func(Of PstMessage, Boolean)) As MessageQuery

C#

public MessageQuery Where(Func<PstMessage, bool> predicate);

Parameters

predicate Func<PstMessage, Boolean>

Returns

MessageQuery

WithAttachments(Boolean) method

VB.NET

Public Function WithAttachments(Optional value As Boolean = True) As MessageQuery

C#

public MessageQuery WithAttachments(bool value = true);

Parameters

value Boolean

Returns

MessageQuery

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

ModifiedOccurrence class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

One occurrence of a recurring appointment that was changed on its own: moved to another time, or given its own subject or location.

VB.NET

Public NotInheritable Class ModifiedOccurrence

C#

public sealed class ModifiedOccurrence

Properties

NameDescription
EndUtcWhen the occurrence now ends (UTC).
LocationThe occurrence's own location; Nothing when it keeps the series' location.
OriginalDateThe day the pattern put this occurrence on, at midnight: a day on the series' own calendar (in its time zone), of no Kind.
StartUtcWhen the occurrence now starts (UTC).
SubjectThe occurrence's own subject; Nothing when it keeps the series' subject.

Details

EndUtc property

When the occurrence now ends (UTC).

VB.NET

Public ReadOnly Property EndUtc As Date

C#

public DateTime EndUtc { get; }

Property value

DateTime

Location property

The occurrence's own location; Nothing when it keeps the series' location.

VB.NET

Public ReadOnly Property Location As String

C#

public string Location { get; }

Property value

String

OriginalDate property

The day the pattern put this occurrence on, at midnight: a day on the series' own calendar (in its time zone), of no Kind.

VB.NET

Public ReadOnly Property OriginalDate As Date

C#

public DateTime OriginalDate { get; }

Property value

DateTime

StartUtc property

When the occurrence now starts (UTC).

VB.NET

Public ReadOnly Property StartUtc As Date

C#

public DateTime StartUtc { get; }

Property value

DateTime

Subject property

The occurrence's own subject; Nothing when it keeps the series' subject.

VB.NET

Public ReadOnly Property Subject As String

C#

public string Subject { get; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

NoteItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class NoteItem
    Inherits Item
    Implements INoteItem

C#

public sealed class NoteItem : Item, INoteItem

Inherits: Item

Implements: INoteItem

Properties

NameDescription
Color
Height
Width

Details

Color property

VB.NET

Public ReadOnly Property Color As Integer

C#

public int Color { get; }

Property value

Int32

Height property

VB.NET

Public ReadOnly Property Height As Integer

C#

public int Height { get; }

Property value

Int32

Width property

VB.NET

Public ReadOnly Property Width As Integer

C#

public int Width { get; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

OpenResult class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Result of PersonalStorage.TryOpen: ErrorCode 0 = opened, Store usable.

VB.NET

Public NotInheritable Class OpenResult
    Inherits OperationResult

C#

public sealed class OpenResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
OpenResult()

Properties

NameDescription
StoreThe opened store (Nothing on failure). Dispose it when done.

Details

OpenResult() constructor

VB.NET

Public Sub New()

C#

public OpenResult();

Store property

The opened store (Nothing on failure). Dispose it when done.

VB.NET

Public Property Store As PersonalStorage

C#

public PersonalStorage Store { get; set; }

Property value

PersonalStorage

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

PersonalStorage class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

An opened PST or OST file: the way in to its folders and items.

VB.NET

Public NotInheritable Class PersonalStorage
    Implements IDisposable

C#

public sealed class PersonalStorage : IDisposable

Implements: IDisposable

Remarks

TryOpen is the result-returning way to open a file: it never throws for a file that is missing, locked or not a PST, and reports an ErrorCode instead. Open throws for the same conditions.

The object model reads lazily, so damage inside an opened file is met when the damaged part is asked for. Property getters on this class, on Folder and on PstMessage throw InvalidDataException or KeyNotFoundException when the item they read is damaged. Enumerating a folder does not throw for a damaged table: it returns the rows that could be read, raises PstEvents.PstError, and counts the table in UnreadableFolderTables. ChecksumErrors and HeaderChecksumValid report damage the file's own checksums reveal.

Properties

NameDescription
ChecksumErrorsHow many distinct data blocks and index pages have failed their checksum since the file was opened. Zero means none met so far: blocks are checked as they are read, so only a complete read of the store (an export, a merge, a validation) makes the figure final. A block that fails its checksum is still returned to a caller walking the object model, and PstEvents.PstError is raised for it once.
DisplayNameThe store's display name (PidTagDisplayName on the message store).
Format
HasPasswordTrue when the file has an open password set (PidTagPstPassword present and non-zero on the message store). A PST password is a stored CRC hash, not encryption — the library reads the file regardless. Set or clear it with Convert.StorePassword.SetPassword / RemovePassword. Always False for an OST, which cannot have a password; an Outlook 2013+ OST stores 0xFFFFFFFF in the property, which is not a password.
HeaderChecksumValidFalse when the file's header fails its own checksum: the header was damaged or written by something that does not maintain it, and what it says about the rest of the file deserves less trust.
IsUnicode
RootFolderThe root Folder object (NID 0x122). Its subfolders include the IPM subtree.
SourcePathThe file this store was opened from, or "" when it was opened from a stream. A host with several stores open needs to know which one an item came from, and every row the view layer produces carries it.
SupportsWritingAlways False for now — this build reads but does not write.
UnreadableFolderTablesHow many folder tables (of subfolders, of messages, or of associated items) could not be read, or could be read only in part, since the file was opened. Each such folder showed fewer entries than it holds. Zero means none met so far; a folder that has not been enumerated has not been judged.
ViewsThe store's sections — mail, calendar, contacts, tasks, notes — as bindable rows: store.Views.Contacts(), store.Views.Mail(query). This is what a host binds a grid or a card view to; see ItemQuery for filtering that avoids opening items it can rule out from the folder's contents table.

Methods

NameDescription
Dispose()
IsAnsi(String) staticTrue if path is a legacy ANSI PST — i.e. adding to or editing it would upgrade it to Unicode (see the AnsiUpgradeRequired gate). Cheap header-only check.
Open(Stream, Boolean) staticOpen a PST/OST from a seekable stream.
Open(String) staticOpen a PST/OST file for reading.
PeekFormat(String) staticCheap pre-flight: report a file's PST format by reading ONLY its header (no full parse, no lock held). Returns PstFormat.Ansi / PstFormat.Unicode, or PstFormat.Unknown if the file is missing, unreadable, or not a PST/OST. Use before a write to warn that adding to an ANSI store will upgrade it to Unicode.
Search(MessageQuery)Search the whole store for messages matching query.
TryOpen(String) staticOpen a PST/OST for reading WITHOUT throwing: the result carries ErrorCode (0 = opened and .Store usable; otherwise FileNotFound / FileLocked (mounted in Outlook?) / InvalidPstFormat / … with a human-readable ErrorDescription). Dispose the Store when done.

Details

ChecksumErrors property

How many distinct data blocks and index pages have failed their checksum since the file was opened. Zero means none met so far: blocks are checked as they are read, so only a complete read of the store (an export, a merge, a validation) makes the figure final. A block that fails its checksum is still returned to a caller walking the object model, and PstEvents.PstError is raised for it once.

VB.NET

Public ReadOnly Property ChecksumErrors As Integer

C#

public int ChecksumErrors { get; }

Property value

Int32

DisplayName property

The store's display name (PidTagDisplayName on the message store).

VB.NET

Public ReadOnly Property DisplayName As String

C#

public string DisplayName { get; }

Property value

String

Format property

VB.NET

Public ReadOnly Property Format As PstFormat

C#

public PstFormat Format { get; }

Property value

PstFormat

HasPassword property

True when the file has an open password set (PidTagPstPassword present and non-zero on the message store). A PST password is a stored CRC hash, not encryption — the library reads the file regardless. Set or clear it with Convert.StorePassword.SetPassword / RemovePassword. Always False for an OST, which cannot have a password; an Outlook 2013+ OST stores 0xFFFFFFFF in the property, which is not a password.

VB.NET

Public ReadOnly Property HasPassword As Boolean

C#

public bool HasPassword { get; }

Property value

Boolean

HeaderChecksumValid property

False when the file's header fails its own checksum: the header was damaged or written by something that does not maintain it, and what it says about the rest of the file deserves less trust.

VB.NET

Public ReadOnly Property HeaderChecksumValid As Boolean

C#

public bool HeaderChecksumValid { get; }

Property value

Boolean

IsUnicode property

VB.NET

Public ReadOnly Property IsUnicode As Boolean

C#

public bool IsUnicode { get; }

Property value

Boolean

RootFolder property

The root Folder object (NID 0x122). Its subfolders include the IPM subtree.

VB.NET

Public ReadOnly Property RootFolder As Folder

C#

public Folder RootFolder { get; }

Property value

Folder

SourcePath property

The file this store was opened from, or "" when it was opened from a stream. A host with several stores open needs to know which one an item came from, and every row the view layer produces carries it.

VB.NET

Public ReadOnly Property SourcePath As String

C#

public string SourcePath { get; }

Property value

String

SupportsWriting property

Always False for now — this build reads but does not write.

VB.NET

Public ReadOnly Property SupportsWriting As Boolean

C#

public bool SupportsWriting { get; }

Property value

Boolean

UnreadableFolderTables property

How many folder tables (of subfolders, of messages, or of associated items) could not be read, or could be read only in part, since the file was opened. Each such folder showed fewer entries than it holds. Zero means none met so far; a folder that has not been enumerated has not been judged.

VB.NET

Public ReadOnly Property UnreadableFolderTables As Integer

C#

public int UnreadableFolderTables { get; }

Property value

Int32

Views property

The store's sections — mail, calendar, contacts, tasks, notes — as bindable rows: store.Views.Contacts(), store.Views.Mail(query). This is what a host binds a grid or a card view to; see ItemQuery for filtering that avoids opening items it can rule out from the folder's contents table.

VB.NET

Public ReadOnly Property Views As StoreViews

C#

public StoreViews Views { get; }

Property value

StoreViews

Dispose() method

VB.NET

Public Sub Dispose()

C#

public void Dispose();

IsAnsi(String) method static

True if path is a legacy ANSI PST — i.e. adding to or editing it would upgrade it to Unicode (see the AnsiUpgradeRequired gate). Cheap header-only check.

VB.NET

Public Shared Function IsAnsi(path As String) As Boolean

C#

public static bool IsAnsi(string path);

Parameters

path String

Returns

Boolean

Open(Stream, Boolean) method static

Open a PST/OST from a seekable stream.

VB.NET

Public Shared Function Open(stm As Stream, Optional leaveOpen As Boolean = False) As PersonalStorage

C#

public static PersonalStorage Open(Stream stm, bool leaveOpen = false);

Parameters

stm Stream
leaveOpen Boolean

Returns

PersonalStorage

Open(String) method static

Open a PST/OST file for reading.

VB.NET

Public Shared Function Open(path As String) As PersonalStorage

C#

public static PersonalStorage Open(string path);

Parameters

path String

Returns

PersonalStorage

PeekFormat(String) method static

Cheap pre-flight: report a file's PST format by reading ONLY its header (no full parse, no lock held). Returns PstFormat.Ansi / PstFormat.Unicode, or PstFormat.Unknown if the file is missing, unreadable, or not a PST/OST. Use before a write to warn that adding to an ANSI store will upgrade it to Unicode.

VB.NET

Public Shared Function PeekFormat(path As String) As PstFormat

C#

public static PstFormat PeekFormat(string path);

Parameters

path String

Returns

PstFormat

TryOpen(String) method static

Open a PST/OST for reading WITHOUT throwing: the result carries ErrorCode (0 = opened and .Store usable; otherwise FileNotFound / FileLocked (mounted in Outlook?) / InvalidPstFormat / … with a human-readable ErrorDescription). Dispose the Store when done.

VB.NET

Public Shared Function TryOpen(path As String) As OpenResult

C#

public static OpenResult TryOpen(string path);

Parameters

path String

Returns

OpenResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

PstMessage class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

A message or other item (contact, appointment, task, note) of an opened store.

VB.NET

Public NotInheritable Class PstMessage

C#

public sealed class PstMessage

Remarks

The item is read on first use, not when it is listed: a folder's contents table can list a message whose data is damaged or gone. Property getters then throw InvalidDataException or KeyNotFoundException. They do not return an error code; PersonalStorage.TryOpen is the result-returning way to open a file, and the operations that return an OperationResult are the way to process one without handling exceptions.

Because the whole property set is read together, one unreadable property makes every getter of the item throw, not only the getter for that property.

ToString never throws.

Properties

NameDescription
AppointmentEndAppointment end (PidLidAppointmentEndWhole), for calendar items.
AppointmentStartAppointment start (PidLidAppointmentStartWhole), for calendar items.
AttachmentsThe message attachments, from the Attachment Table subnode (empty if none).
Body
ContactEmailPrimary email address (PidLidEmail1EmailAddress), for contact items.
DeliveryTime
HasAttachments
ImportancePidTagImportance (0=low, 1=normal, 2=high); 1 if unset.
InternetMessageIdPidTagInternetMessageId.
IsUnreadTrue when the message is unread (MSGFLAG_READ not set).
Kind
LocationAppointment / meeting location (PidLidLocation).
MessageClass
MessageFlagsPidTagMessageFlags.
NodeIdThe message's stable node identifier within its open store — the value a host application uses to correlate a list row with the message and to reopen it for detail (see Folder.OpenMessage). Stable for the lifetime of the open store.
RecipientsThe message recipients (To/Cc/Bcc), from the Recipient Table subnode.
SenderEmail
SenderName
SizePidTagMessageSize.
SubjectThe subject, with any stored prefix marker removed.
SubmitTime

Methods

NameDescription
AsItem()Project this message as the typed item interface matching its message class (mail, appointment, contact, task, note, journal, distribution list). Read-only and allocation-cheap — wrap, read, discard, per message.
ToString()Never throws: a debugger, a log line or a list box calls this on whatever it is given, and a damaged message must not take that down.

Details

AppointmentEnd property

Appointment end (PidLidAppointmentEndWhole), for calendar items.

VB.NET

Public ReadOnly Property AppointmentEnd As Date?

C#

public DateTime? AppointmentEnd { get; }

Property value

Nullable<DateTime>

AppointmentStart property

Appointment start (PidLidAppointmentStartWhole), for calendar items.

VB.NET

Public ReadOnly Property AppointmentStart As Date?

C#

public DateTime? AppointmentStart { get; }

Property value

Nullable<DateTime>

Attachments property

The message attachments, from the Attachment Table subnode (empty if none).

VB.NET

Public ReadOnly Property Attachments As IReadOnlyList(Of Attachment)

C#

public IReadOnlyList<Attachment> Attachments { get; }

Property value

IReadOnlyList<Attachment>

Remarks

An attachment the item lists whose data is missing, or whose own properties cannot be read, is left out of the list and recorded as a loss on the running operation (in an operation that does not tolerate damage, the read throws instead). The list is read once and kept, so the same loss is recorded again on every later operation that reads it: each one is told that its output lacks the attachment.

Body property

VB.NET

Public ReadOnly Property Body As String

C#

public string Body { get; }

Property value

String

ContactEmail property

Primary email address (PidLidEmail1EmailAddress), for contact items.

VB.NET

Public ReadOnly Property ContactEmail As String

C#

public string ContactEmail { get; }

Property value

String

DeliveryTime property

VB.NET

Public ReadOnly Property DeliveryTime As Date?

C#

public DateTime? DeliveryTime { get; }

Property value

Nullable<DateTime>

HasAttachments property

VB.NET

Public ReadOnly Property HasAttachments As Boolean

C#

public bool HasAttachments { get; }

Property value

Boolean

Importance property

PidTagImportance (0=low, 1=normal, 2=high); 1 if unset.

VB.NET

Public ReadOnly Property Importance As Integer

C#

public int Importance { get; }

Property value

Int32

InternetMessageId property

PidTagInternetMessageId.

VB.NET

Public ReadOnly Property InternetMessageId As String

C#

public string InternetMessageId { get; }

Property value

String

IsUnread property

True when the message is unread (MSGFLAG_READ not set).

VB.NET

Public ReadOnly Property IsUnread As Boolean

C#

public bool IsUnread { get; }

Property value

Boolean

Kind property

VB.NET

Public ReadOnly Property Kind As ItemKind

C#

public ItemKind Kind { get; }

Property value

ItemKind

Location property

Appointment / meeting location (PidLidLocation).

VB.NET

Public ReadOnly Property Location As String

C#

public string Location { get; }

Property value

String

MessageClass property

VB.NET

Public ReadOnly Property MessageClass As String

C#

public string MessageClass { get; }

Property value

String

MessageFlags property

PidTagMessageFlags.

VB.NET

Public ReadOnly Property MessageFlags As Integer

C#

public int MessageFlags { get; }

Property value

Int32

NodeId property

The message's stable node identifier within its open store — the value a host application uses to correlate a list row with the message and to reopen it for detail (see Folder.OpenMessage). Stable for the lifetime of the open store.

VB.NET

Public ReadOnly Property NodeId As UInteger

C#

public uint NodeId { get; }

Property value

UInt32

Recipients property

The message recipients (To/Cc/Bcc), from the Recipient Table subnode.

VB.NET

Public ReadOnly Property Recipients As IReadOnlyList(Of Recipient)

C#

public IReadOnlyList<Recipient> Recipients { get; }

Property value

IReadOnlyList<Recipient>

SenderEmail property

VB.NET

Public ReadOnly Property SenderEmail As String

C#

public string SenderEmail { get; }

Property value

String

SenderName property

VB.NET

Public ReadOnly Property SenderName As String

C#

public string SenderName { get; }

Property value

String

Size property

PidTagMessageSize.

VB.NET

Public ReadOnly Property Size As Integer

C#

public int Size { get; }

Property value

Int32

Subject property

The subject, with any stored prefix marker removed.

VB.NET

Public ReadOnly Property Subject As String

C#

public string Subject { get; }

Property value

String

SubmitTime property

VB.NET

Public ReadOnly Property SubmitTime As Date?

C#

public DateTime? SubmitTime { get; }

Property value

Nullable<DateTime>

AsItem() method

Project this message as the typed item interface matching its message class (mail, appointment, contact, task, note, journal, distribution list). Read-only and allocation-cheap — wrap, read, discard, per message.

VB.NET

Public Function AsItem() As IItem

C#

public IItem AsItem();

Returns

IItem

ToString() method

Never throws: a debugger, a log line or a list box calls this on whatever it is given, and a damaged message must not take that down.

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

Recipient class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class Recipient

C#

public sealed class Recipient

Properties

NameDescription
AddressThe best available address for display (SMTP if present, else the email address).
AddressType
DisplayName
EmailAddress
RecipientType
SmtpAddress

Methods

NameDescription
ToString()

Details

Address property

The best available address for display (SMTP if present, else the email address).

VB.NET

Public ReadOnly Property Address As String

C#

public string Address { get; }

Property value

String

AddressType property

VB.NET

Public ReadOnly Property AddressType As String

C#

public string AddressType { get; }

Property value

String

DisplayName property

VB.NET

Public ReadOnly Property DisplayName As String

C#

public string DisplayName { get; }

Property value

String

EmailAddress property

VB.NET

Public ReadOnly Property EmailAddress As String

C#

public string EmailAddress { get; }

Property value

String

RecipientType property

VB.NET

Public ReadOnly Property RecipientType As RecipientType

C#

public RecipientType RecipientType { get; }

Property value

RecipientType

SmtpAddress property

VB.NET

Public ReadOnly Property SmtpAddress As String

C#

public string SmtpAddress { get; }

Property value

String

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

RecipientType enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

PidTagRecipientType (0x0C15) — the role of a recipient on a message.

VB.NET

Public Enum RecipientType

C#

public enum RecipientType

Members

NameValueDescription
Originator0Original author / sender slot (0).
To1
Cc2
Bcc3

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

RecurrenceEndKind enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

How a recurring series ends.

VB.NET

Public Enum RecurrenceEndKind

C#

public enum RecurrenceEndKind

Members

NameValueDescription
Never0It has no end.
AfterCount1After a number of occurrences: AppointmentRecurrence.OccurrenceCount.
OnDate2On a date: AppointmentRecurrence.EndDate.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

SearchEngine class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

Walks a folder subtree applying a MessageQuery.

VB.NET

Public NotInheritable Class SearchEngine

C#

public sealed class SearchEngine

Methods

NameDescription
Find(PersonalStorage, MessageQuery) staticSearch the whole store.
Walk(Folder, String, MessageQuery) staticSearch a folder subtree.

Details

Find(PersonalStorage, MessageQuery) method static

Search the whole store.

VB.NET

Public Shared Function Find(store As PersonalStorage, query As MessageQuery) As IEnumerable(Of SearchHit)

C#

public static IEnumerable<SearchHit> Find(PersonalStorage store, MessageQuery query);

Parameters

store PersonalStorage
query MessageQuery

Returns

IEnumerable<SearchHit>

Exceptions

ExceptionCondition
ArgumentNullExceptionstore or query is Nothing.

Remarks

The result is produced as it is enumerated. A message that cannot be read while the query is tested is left out and reported: as a loss on the operation that is running, or, when the caller is walking the object model directly, through PstEvents.PstError. An operation that is not recovering from damage fails on it instead. An exception thrown by a predicate given to MessageQuery.Where is the caller's and propagates.

Walk(Folder, String, MessageQuery) method static

Search a folder subtree.

VB.NET

Public Shared Function Walk(folder As Folder, parentPath As String, query As MessageQuery) As IEnumerable(Of SearchHit)

C#

public static IEnumerable<SearchHit> Walk(Folder folder, string parentPath, MessageQuery query);

Parameters

folder Folder
parentPath String
query MessageQuery

Returns

IEnumerable<SearchHit>

Exceptions

ExceptionCondition
ArgumentNullExceptionfolder or query is Nothing.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

SearchHit class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

A search result: the message and the folder path it was found in.

VB.NET

Public NotInheritable Class SearchHit

C#

public sealed class SearchHit

Properties

NameDescription
FolderPath
Message

Details

FolderPath property

VB.NET

Public ReadOnly Property FolderPath As String

C#

public string FolderPath { get; }

Property value

String

Message property

VB.NET

Public ReadOnly Property Message As PstMessage

C#

public PstMessage Message { get; }

Property value

PstMessage

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

Sensitivity enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

PidTagSensitivity (0x0036).

VB.NET

Public Enum Sensitivity

C#

public enum Sensitivity

Members

NameValueDescription
Normal0
Personal1
Private22
Confidential3

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

TaskItem class

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class TaskItem
    Inherits Item
    Implements ITaskItem

C#

public sealed class TaskItem : Item, ITaskItem

Inherits: Item

Implements: ITaskItem

Properties

NameDescription
DateCompletedThe day the task was completed, at midnight (a calendar day, as StartDate). Unlike the other two it is stored as an instant, midnight on the day in the time zone of whoever completed it ([MS-OXOTASK] 2.2.2.2.9), so the day given is that instant's day on THIS computer's clock.
DueDateThe day the task is due, at midnight (a calendar day, as StartDate). Nothing when the task has no due date.
Importance
IsComplete
Owner
PercentComplete
StartDateThe day work on the task starts, at midnight (a calendar day: its Kind is Unspecified, and it is the same day in every time zone). Nothing when the task has no start date.
Status

Details

DateCompleted property

The day the task was completed, at midnight (a calendar day, as StartDate). Unlike the other two it is stored as an instant, midnight on the day in the time zone of whoever completed it ([MS-OXOTASK] 2.2.2.2.9), so the day given is that instant's day on THIS computer's clock.

VB.NET

Public ReadOnly Property DateCompleted As Date?

C#

public DateTime? DateCompleted { get; }

Property value

Nullable<DateTime>

DueDate property

The day the task is due, at midnight (a calendar day, as StartDate). Nothing when the task has no due date.

VB.NET

Public ReadOnly Property DueDate As Date?

C#

public DateTime? DueDate { get; }

Property value

Nullable<DateTime>

Importance property

VB.NET

Public ReadOnly Property Importance As Importance

C#

public Importance Importance { get; }

Property value

Importance

IsComplete property

VB.NET

Public ReadOnly Property IsComplete As Boolean

C#

public bool IsComplete { get; }

Property value

Boolean

Owner property

VB.NET

Public ReadOnly Property Owner As String

C#

public string Owner { get; }

Property value

String

PercentComplete property

VB.NET

Public ReadOnly Property PercentComplete As Double

C#

public double PercentComplete { get; }

Property value

Double

StartDate property

The day work on the task starts, at midnight (a calendar day: its Kind is Unspecified, and it is the same day in every time zone). Nothing when the task has no start date.

VB.NET

Public ReadOnly Property StartDate As Date?

C#

public DateTime? StartDate { get; }

Property value

Nullable<DateTime>

Status property

VB.NET

Public ReadOnly Property Status As TaskStatus

C#

public TaskStatus Status { get; }

Property value

TaskStatus

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace

TaskStatus enumeration

Namespace: Bastion.Pst.Messaging · Assembly: Bastion.Pst.dll

PidLidTaskStatus (PSETID_Task 0x8101).

VB.NET

Public Enum TaskStatus

C#

public enum TaskStatus

Members

NameValueDescription
NotStarted0
InProgress1
Complete2
Waiting3
Deferred4

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Ndb namespace

Assembly: Bastion.Pst.dll

Enumerations

NameDescription
PstFormatOn-disk PST/OST format variant. The NDB layer is the only layer that distinguishes these; everything above it is format-agnostic ([MS-PST] 2.2.2.6).

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Ndb namespace

PstFormat enumeration

Namespace: Bastion.Pst.Ndb · Assembly: Bastion.Pst.dll

On-disk PST/OST format variant. The NDB layer is the only layer that distinguishes these; everything above it is format-agnostic ([MS-PST] 2.2.2.6).

VB.NET

Public Enum PstFormat

C#

public enum PstFormat

Members

NameValueDescription
Unknown0Not yet determined.
Ansi1ANSI PST — 32-bit BID/IB, 2 GB-capped legacy format (wVer 14/15).
Unicode2Unicode PST/OST — 64-bit BID/IB (wVer >= 23).

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Repair namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
PstRepairRebuilds a damaged PST or OST into a new, structurally sound Unicode PST.
RepairReportOutcome of a PstRepair.Repair: the result code, what was recovered and what was not, and the strict validation of the source (before) and the rebuilt output (after). ErrorCode has three kinds of value. 0: the output is valid and nothing was lost. 15 (CompletedWithLosses): the output is valid and can be used, but content is missing from it or incomplete in it; Losses lists each case and the counters below summarise. Anything else: the repair failed and nothing was written to OutputPath; with 16 (OutputInvalid) the file that failed its checks is kept as InvalidOutputPath. OutputWritten is True for 0 and 15.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Repair namespace

PstRepair class

Namespace: Bastion.Pst.Repair · Assembly: Bastion.Pst.dll

Rebuilds a damaged PST or OST into a new, structurally sound Unicode PST.

VB.NET

Public NotInheritable Class PstRepair

C#

public sealed class PstRepair

Remarks

Repair never throws (a licence refusal apart) and never modifies the source. Test the result's ErrorCode; there are three outcomes:

0 (Ok): the output passes the structural check, every message it lists opens, and nothing readable was left out.

15 (CompletedWithLosses): the output passes the structural check and is safe to use, but some content could not be recovered. Losses lists each item and LossCount counts them; RepairReport.MessagesLost and the other counters summarise. This is the usual result for a file that was really damaged.

Any other code: the repair failed, nothing was written to the destination and a file already there is untouched. With OutputInvalid (16) the repair did produce a file, but it does not pass its checks: it is kept beside the destination as <destination>.invalid, named by RepairReport.InvalidOutputPath, for analysis only. Do not use it, and delete it when it is no longer wanted.

OutputWritten is True for the first two.

Methods

NameDescription
Repair(String, String, DiagnosticsContext, Boolean, Boolean, Int64) staticRepair srcPath into a fresh, structurally-canonical Unicode PST at outPath. A repair always carries on past damage: an item that cannot be read is left out and listed in the result's Losses, whatever DiagnosticsContext.RecoverFromCorruption says. Returns the before and after validation, the counts, and the result code described on PstRepair: 0 clean, 15 usable with losses, anything else failed.

Details

Repair(String, String, DiagnosticsContext, Boolean, Boolean, Int64) method static

Repair srcPath into a fresh, structurally-canonical Unicode PST at outPath. A repair always carries on past damage: an item that cannot be read is left out and listed in the result's Losses, whatever DiagnosticsContext.RecoverFromCorruption says. Returns the before and after validation, the counts, and the result code described on PstRepair: 0 clean, 15 usable with losses, anything else failed.

VB.NET

Public Shared Function Repair(
    srcPath As String,
    outPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False,
    Optional stripPassword As Boolean = False,
    Optional maxBytes As Long = 0
) As RepairReport

C#

public static RepairReport Repair(
    string srcPath,
    string outPath,
    DiagnosticsContext diag = null,
    bool overwrite = false,
    bool stripPassword = false,
    long maxBytes = 0
);

Parameters

srcPath String
outPath String
Where to write the repaired copy. It must not be the source file.
diag DiagnosticsContext
overwrite Boolean
stripPassword Boolean
When True, clears PidTagPstPassword on the message store so the repaired file opens without a password prompt. (A PST password is only a stored hash, not encryption; the source's password — if any — is otherwise copied through verbatim.)
maxBytes Int64
Optional hard output-size cap in bytes (<= 0 = unlimited). When set, the repair fails with OutputSizeExceeded rather than writing a file that would exceed it.

Returns

RepairReport

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Repair namespace

RepairReport class

Namespace: Bastion.Pst.Repair · Assembly: Bastion.Pst.dll

Outcome of a PstRepair.Repair: the result code, what was recovered and what was not, and the strict validation of the source (before) and the rebuilt output (after). ErrorCode has three kinds of value. 0: the output is valid and nothing was lost. 15 (CompletedWithLosses): the output is valid and can be used, but content is missing from it or incomplete in it; Losses lists each case and the counters below summarise. Anything else: the repair failed and nothing was written to OutputPath; with 16 (OutputInvalid) the file that failed its checks is kept as InvalidOutputPath. OutputWritten is True for 0 and 15.

VB.NET

Public NotInheritable Class RepairReport
    Inherits OperationResult

C#

public sealed class RepairReport : OperationResult

Inherits: OperationResult

Constructors

NameDescription
RepairReport()

Properties

NameDescription
BlocksScavengedData blocks recovered the same way. See NodesScavenged.
FoldersRecreatedFolders whose own record was destroyed and was written afresh, because mail or subfolders still named them. Such a folder keeps its contents; its name comes from its parent's list or its role where known, and otherwise is "Recovered folder".
FoldersRefiledFolders that had been cut off from the folder tree and were re-attached under their original parent folder.
FolderTablesUnreadableFolders of the repaired output with a list (of messages or of subfolders) that could not be read back. Each is listed in Losses.
InvalidOutputPathSet only with ErrorCode 16 (OutputInvalid): the path of the file the repair produced, which did not pass its checks. It is OutputPath with .invalid added, beside the destination, and replaces one left there by an earlier run. It is kept so that it can be examined or sent for analysis; it must not be used as a mail file, and the caller deletes it when it is no longer wanted. Nothing (null) otherwise, and also when the file could not be kept (ErrorDescription says so). The destination itself is never created or replaced by a file known to be bad.
ItemsRefiledMessages that had dropped out of their folder's contents table and were put back into that same folder, found from the message's own record of its parent.
ItemsSampledMessages opened in the REPAIRED output to see whether their content reads, and how many of them would not. Every message every folder lists is opened (class, subject and body); the name is kept from when this was a sample. Structural validity is not the same thing as readable mail, and repair cannot make it so. Repair rebuilds the store's geometry; where a message's property data has been overwritten, those bytes are gone and no rebuild can invent them. The output is then perfectly valid and still cannot produce that message. Reporting only the structural verdict tells a customer their archive is fixed when a measurable part of it is not. 0 of 0 when the output failed the structural check or could not be reopened, in which case ErrorCode is OutputInvalid.
ItemsUnreadableOf ItemsSampled, how many would not open. Each is listed in Losses, and any makes the result CompletedWithLosses.
ListEntriesRemovedFolder-list entries taken out because the message behind them is missing or could not be read. A repaired store lists only messages that can be opened.
MessagesIncompleteMessages that were recovered without part of their content (usually the body), because the block holding it could not be read. They open, with that part empty.
MessagesLostMessages too badly damaged to read. They are left out of the repaired store, and their entries are taken out of the folder lists as well, so every message the repaired store lists can be opened. 0 when nothing was lost.
MessagesMissingFromIndexMessages that a folder of the source listed but that were not in the source's index at all, usually because a page of the index was damaged. They could not be recovered; each is in Losses with its folder and node id, and their list entries are among ListEntriesRemoved. (A message lost this way that no folder listed cannot be counted: the index was the only record of it.) Not included in MessagesLost, which counts messages that were found and could not be read.
MessagesNotListedMessages that no folder listed and for which a list entry could not be rebuilt. They are in the repaired file but no folder shows them. Each is in Losses.
NodesScavengedItem records recovered from intact older copies after the index pointing at them was found damaged. Good news, not a loss.
NodesSkippedThings other than messages that could not be read and were left out: folder objects, folder tables and other records. See also TablesLost.
NodesWritten
OrphansLeftUnreachableWhen RecoveryAbandoned, how many messages no folder lists were left that way. 0 when that could not be worked out.
OrphansRecoveredMessages whose folder could not be recovered, placed in a "Lost and Found" folder.
OutputIsValidTrue when the repaired output passes strict structural validation. It says nothing about whether content was lost: a valid output with losses has ErrorCode 15. False when the output could not be validated.
OutputPathThe destination asked for. It holds the repaired file only when OutputWritten is True (code 0 or 15); after any other code it is as it was before the repair ran: absent, or still the file that was already there.
OutputReportValidation of the rebuilt output.
PagesSkippedPages of the source's index that could not be read. Whatever was reachable only through them is lost, and cannot be counted: the index was the only record of it.
PasswordStrippedTrue if the password property was cleared on the output.
RecoveryAbandonedTrue when putting orphaned mail and folders back was attempted and given up (it failed, or its result could not be made sound). The repaired file is then either the plain rebuild, in which what was unreachable in the source still is, or, when the attempt had recovered more messages than the plain rebuild lists, a new store with every recovered message in "Lost and Found" (OrphansLeftUnreachable is then 0 and WrittenIntoNewStore True). Losses says which.
RecoveryNotPossibleTrue when the folder tree could not be worked out at all, so orphaned mail was not looked for. Different from there being none: see Warnings for the reason.
SourcePath
SourceReportValidation of the source as supplied (Nothing if it could not be validated at all).
SourceWasValid
StorePcSynthesisedTrue when the store's own settings record was destroyed and a new one was written. The repaired file's display name is then the source's file name.
SubtreeReconnectedTrue when the mailbox's folder tree was reconnected to the store root (its root link had been destroyed, orphaning every folder).
SucceededTrue only for a clean repair: ErrorCode 0 and a valid output, with nothing lost. A repair that produced a usable file but could not recover everything is False here, with ErrorCode 15 and OutputWritten True; test those to accept it.
TablesLostOf NodesSkipped, the folder lists (of messages or of subfolders). The items such a list named may be in the repaired file without being listed.
WrittenIntoNewStoreTrue when the repaired file is a NEW store, made from the library's empty-store template, into which the recovered folders and messages were copied. That is done only when the damaged file cannot supply what nothing can restate: the store's own record (or a record naming special folders that are gone), the root folder's record or its list of folders, or the named-property map. The folders keep their names and places under the new store's top folder (those that cannot be placed are in "Lost and Found"); the store has a new identity, and Losses says what could not be carried. Until 11 Nov 2026 such a file was patched instead, and Outlook refused the result. A store that has lost only a table template, a search queue or a folder's list keeps its identity: those are written again in place (see Warnings). Also True when the recovered folders could not be written into a sound store and the recovered messages were placed in a new store's "Lost and Found" instead.

Details

RepairReport() constructor

VB.NET

Public Sub New()

C#

public RepairReport();

BlocksScavenged property

Data blocks recovered the same way. See NodesScavenged.

VB.NET

Public Property BlocksScavenged As Integer

C#

public int BlocksScavenged { get; set; }

Property value

Int32

FoldersRecreated property

Folders whose own record was destroyed and was written afresh, because mail or subfolders still named them. Such a folder keeps its contents; its name comes from its parent's list or its role where known, and otherwise is "Recovered folder".

VB.NET

Public Property FoldersRecreated As Integer

C#

public int FoldersRecreated { get; set; }

Property value

Int32

FoldersRefiled property

Folders that had been cut off from the folder tree and were re-attached under their original parent folder.

VB.NET

Public Property FoldersRefiled As Integer

C#

public int FoldersRefiled { get; set; }

Property value

Int32

FolderTablesUnreadable property

Folders of the repaired output with a list (of messages or of subfolders) that could not be read back. Each is listed in Losses.

VB.NET

Public Property FolderTablesUnreadable As Integer

C#

public int FolderTablesUnreadable { get; set; }

Property value

Int32

InvalidOutputPath property

Set only with ErrorCode 16 (OutputInvalid): the path of the file the repair produced, which did not pass its checks. It is OutputPath with .invalid added, beside the destination, and replaces one left there by an earlier run. It is kept so that it can be examined or sent for analysis; it must not be used as a mail file, and the caller deletes it when it is no longer wanted. Nothing (null) otherwise, and also when the file could not be kept (ErrorDescription says so). The destination itself is never created or replaced by a file known to be bad.

VB.NET

Public Property InvalidOutputPath As String

C#

public string InvalidOutputPath { get; set; }

Property value

String

ItemsRefiled property

Messages that had dropped out of their folder's contents table and were put back into that same folder, found from the message's own record of its parent.

VB.NET

Public Property ItemsRefiled As Integer

C#

public int ItemsRefiled { get; set; }

Property value

Int32

ItemsSampled property

Messages opened in the REPAIRED output to see whether their content reads, and how many of them would not. Every message every folder lists is opened (class, subject and body); the name is kept from when this was a sample. Structural validity is not the same thing as readable mail, and repair cannot make it so. Repair rebuilds the store's geometry; where a message's property data has been overwritten, those bytes are gone and no rebuild can invent them. The output is then perfectly valid and still cannot produce that message. Reporting only the structural verdict tells a customer their archive is fixed when a measurable part of it is not. 0 of 0 when the output failed the structural check or could not be reopened, in which case ErrorCode is OutputInvalid.

VB.NET

Public Property ItemsSampled As Integer

C#

public int ItemsSampled { get; set; }

Property value

Int32

ItemsUnreadable property

Of ItemsSampled, how many would not open. Each is listed in Losses, and any makes the result CompletedWithLosses.

VB.NET

Public Property ItemsUnreadable As Integer

C#

public int ItemsUnreadable { get; set; }

Property value

Int32

ListEntriesRemoved property

Folder-list entries taken out because the message behind them is missing or could not be read. A repaired store lists only messages that can be opened.

VB.NET

Public Property ListEntriesRemoved As Integer

C#

public int ListEntriesRemoved { get; set; }

Property value

Int32

MessagesIncomplete property

Messages that were recovered without part of their content (usually the body), because the block holding it could not be read. They open, with that part empty.

VB.NET

Public Property MessagesIncomplete As Integer

C#

public int MessagesIncomplete { get; set; }

Property value

Int32

MessagesLost property

Messages too badly damaged to read. They are left out of the repaired store, and their entries are taken out of the folder lists as well, so every message the repaired store lists can be opened. 0 when nothing was lost.

VB.NET

Public Property MessagesLost As Integer

C#

public int MessagesLost { get; set; }

Property value

Int32

MessagesMissingFromIndex property

Messages that a folder of the source listed but that were not in the source's index at all, usually because a page of the index was damaged. They could not be recovered; each is in Losses with its folder and node id, and their list entries are among ListEntriesRemoved. (A message lost this way that no folder listed cannot be counted: the index was the only record of it.) Not included in MessagesLost, which counts messages that were found and could not be read.

VB.NET

Public Property MessagesMissingFromIndex As Integer

C#

public int MessagesMissingFromIndex { get; set; }

Property value

Int32

MessagesNotListed property

Messages that no folder listed and for which a list entry could not be rebuilt. They are in the repaired file but no folder shows them. Each is in Losses.

VB.NET

Public Property MessagesNotListed As Integer

C#

public int MessagesNotListed { get; set; }

Property value

Int32

NodesScavenged property

Item records recovered from intact older copies after the index pointing at them was found damaged. Good news, not a loss.

VB.NET

Public Property NodesScavenged As Integer

C#

public int NodesScavenged { get; set; }

Property value

Int32

NodesSkipped property

Things other than messages that could not be read and were left out: folder objects, folder tables and other records. See also TablesLost.

VB.NET

Public Property NodesSkipped As Integer

C#

public int NodesSkipped { get; set; }

Property value

Int32

NodesWritten property

VB.NET

Public Property NodesWritten As Integer

C#

public int NodesWritten { get; set; }

Property value

Int32

OrphansLeftUnreachable property

When RecoveryAbandoned, how many messages no folder lists were left that way. 0 when that could not be worked out.

VB.NET

Public Property OrphansLeftUnreachable As Integer

C#

public int OrphansLeftUnreachable { get; set; }

Property value

Int32

OrphansRecovered property

Messages whose folder could not be recovered, placed in a "Lost and Found" folder.

VB.NET

Public Property OrphansRecovered As Integer

C#

public int OrphansRecovered { get; set; }

Property value

Int32

OutputIsValid property

True when the repaired output passes strict structural validation. It says nothing about whether content was lost: a valid output with losses has ErrorCode 15. False when the output could not be validated.

VB.NET

Public ReadOnly Property OutputIsValid As Boolean

C#

public bool OutputIsValid { get; }

Property value

Boolean

OutputPath property

The destination asked for. It holds the repaired file only when OutputWritten is True (code 0 or 15); after any other code it is as it was before the repair ran: absent, or still the file that was already there.

VB.NET

Public Property OutputPath As String

C#

public string OutputPath { get; set; }

Property value

String

OutputReport property

Validation of the rebuilt output.

VB.NET

Public Property OutputReport As ValidationReport

C#

public ValidationReport OutputReport { get; set; }

Property value

ValidationReport

PagesSkipped property

Pages of the source's index that could not be read. Whatever was reachable only through them is lost, and cannot be counted: the index was the only record of it.

VB.NET

Public Property PagesSkipped As Integer

C#

public int PagesSkipped { get; set; }

Property value

Int32

PasswordStripped property

True if the password property was cleared on the output.

VB.NET

Public Property PasswordStripped As Boolean

C#

public bool PasswordStripped { get; set; }

Property value

Boolean

RecoveryAbandoned property

True when putting orphaned mail and folders back was attempted and given up (it failed, or its result could not be made sound). The repaired file is then either the plain rebuild, in which what was unreachable in the source still is, or, when the attempt had recovered more messages than the plain rebuild lists, a new store with every recovered message in "Lost and Found" (OrphansLeftUnreachable is then 0 and WrittenIntoNewStore True). Losses says which.

VB.NET

Public Property RecoveryAbandoned As Boolean

C#

public bool RecoveryAbandoned { get; set; }

Property value

Boolean

RecoveryNotPossible property

True when the folder tree could not be worked out at all, so orphaned mail was not looked for. Different from there being none: see Warnings for the reason.

VB.NET

Public Property RecoveryNotPossible As Boolean

C#

public bool RecoveryNotPossible { get; set; }

Property value

Boolean

SourcePath property

VB.NET

Public Property SourcePath As String

C#

public string SourcePath { get; set; }

Property value

String

SourceReport property

Validation of the source as supplied (Nothing if it could not be validated at all).

VB.NET

Public Property SourceReport As ValidationReport

C#

public ValidationReport SourceReport { get; set; }

Property value

ValidationReport

SourceWasValid property

VB.NET

Public ReadOnly Property SourceWasValid As Boolean

C#

public bool SourceWasValid { get; }

Property value

Boolean

StorePcSynthesised property

True when the store's own settings record was destroyed and a new one was written. The repaired file's display name is then the source's file name.

VB.NET

Public Property StorePcSynthesised As Boolean

C#

public bool StorePcSynthesised { get; set; }

Property value

Boolean

SubtreeReconnected property

True when the mailbox's folder tree was reconnected to the store root (its root link had been destroyed, orphaning every folder).

VB.NET

Public Property SubtreeReconnected As Boolean

C#

public bool SubtreeReconnected { get; set; }

Property value

Boolean

Succeeded property

True only for a clean repair: ErrorCode 0 and a valid output, with nothing lost. A repair that produced a usable file but could not recover everything is False here, with ErrorCode 15 and OutputWritten True; test those to accept it.

VB.NET

Public Overrides ReadOnly Property Succeeded As Boolean

C#

public override bool Succeeded { get; }

Property value

Boolean

TablesLost property

Of NodesSkipped, the folder lists (of messages or of subfolders). The items such a list named may be in the repaired file without being listed.

VB.NET

Public Property TablesLost As Integer

C#

public int TablesLost { get; set; }

Property value

Int32

WrittenIntoNewStore property

True when the repaired file is a NEW store, made from the library's empty-store template, into which the recovered folders and messages were copied. That is done only when the damaged file cannot supply what nothing can restate: the store's own record (or a record naming special folders that are gone), the root folder's record or its list of folders, or the named-property map. The folders keep their names and places under the new store's top folder (those that cannot be placed are in "Lost and Found"); the store has a new identity, and Losses says what could not be carried. Until 11 Nov 2026 such a file was patched instead, and Outlook refused the result. A store that has lost only a table template, a search queue or a folder's list keeps its identity: those are written again in place (see Warnings). Also True when the recovered folders could not be written into a sound store and the recovered messages were placed in a new store's "Lost and Found" instead.

VB.NET

Public Property WrittenIntoNewStore As Boolean

C#

public bool WrittenIntoNewStore { get; set; }

Property value

Boolean

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Validation namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
HealthResultOutcome of PstHealth.Check. ErrorCode is 0 when the check itself ran — a corrupt-but-examinable file is ErrorCode 0 with IsCorrupted=True; ErrorCode is non-zero only when the file could not be examined at all (FileNotFound, FileLocked, AccessDenied, OperationCancelled, …), and then WasExamined is False and IsCorrupted is False: nothing is known about a file that was not read.
PstHealthOne-call health check for a PST/OST: full structural validation surfaced as a simple corrupted/clean verdict, plus support-report generation and a repair shortcut.
PstValidator
ValidationIssueOne structural problem found by PstValidator.
ValidationReportResult of validating a PST: the issues found and how much was checked. There are three answers, not two. IsValid True: the file was examined and no error was found in what was examined (NotChecked lists what was not). IsValid False with WasExamined True: the file is damaged, and Issues says where. WasExamined False: the file could not be examined at all (missing, locked, access denied, an I/O error, cancelled) and nothing is known about its condition; NotExaminedCode says why. A file in that third state is not valid and is not damaged: do not offer it for repair.

Enumerations

NameDescription
ValidationSeverity

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace

HealthResult class

Namespace: Bastion.Pst.Validation · Assembly: Bastion.Pst.dll

Outcome of PstHealth.Check. ErrorCode is 0 when the check itself ran — a corrupt-but-examinable file is ErrorCode 0 with IsCorrupted=True; ErrorCode is non-zero only when the file could not be examined at all (FileNotFound, FileLocked, AccessDenied, OperationCancelled, …), and then WasExamined is False and IsCorrupted is False: nothing is known about a file that was not read.

VB.NET

Public NotInheritable Class HealthResult
    Inherits OperationResult

C#

public sealed class HealthResult : OperationResult

Inherits: OperationResult

Properties

NameDescription
ErrorCountStructural errors found. 0 for a file that could not be examined.
FatalErrorSet when the check itself failed unexpectedly. Not a finding about the file.
IsCorruptedTrue when the file was examined and has structural errors. False for a clean file AND for one that could not be examined (testing rule 21: a check that cannot look at a file must not call it damaged). Test ErrorCode or WasExamined to tell those two apart; "Not IsCorrupted" alone does not mean the file is sound.
NotCheckedWhat the check did not look at in a file it did examine. See ValidationReport.NotChecked.
Path
ValidationThe full validator report (Nothing only when the check itself failed; see FatalError). For a file that could not be opened it is present, with ValidationReport.WasExamined False.
WasExaminedFalse when the file could not be examined; ErrorCode then says why.

Methods

NameDescription
RepairTo(String, DiagnosticsContext, Boolean)Repair this file to outPath (damaged items are skipped and listed in the report's Losses; everything readable is rebuilt into a structurally-canonical PST). See PstRepair.Repair for the result codes: 0 is a clean repair, 15 a usable file with content missing, anything else a failure.
SaveSupportReport(String, String, String)Write the developer support report (structural metadata only — no message content). outPath names the target file; when empty the report goes to the user's temp folder (or directory when supplied) as BastionPstSdk-SupportReport-<file>-<stamp>.txt. NEVER throws: check the returned result's ErrorCode (0 = written, .Path = where).

Details

ErrorCount property

Structural errors found. 0 for a file that could not be examined.

VB.NET

Public ReadOnly Property ErrorCount As Integer

C#

public int ErrorCount { get; }

Property value

Int32

FatalError property

Set when the check itself failed unexpectedly. Not a finding about the file.

VB.NET

Public ReadOnly Property FatalError As String

C#

public string FatalError { get; }

Property value

String

IsCorrupted property

True when the file was examined and has structural errors. False for a clean file AND for one that could not be examined (testing rule 21: a check that cannot look at a file must not call it damaged). Test ErrorCode or WasExamined to tell those two apart; "Not IsCorrupted" alone does not mean the file is sound.

VB.NET

Public ReadOnly Property IsCorrupted As Boolean

C#

public bool IsCorrupted { get; }

Property value

Boolean

NotChecked property

What the check did not look at in a file it did examine. See ValidationReport.NotChecked.

VB.NET

Public ReadOnly Property NotChecked As IReadOnlyList(Of String)

C#

public IReadOnlyList<string> NotChecked { get; }

Property value

IReadOnlyList<String>

Path property

VB.NET

Public ReadOnly Property Path As String

C#

public string Path { get; }

Property value

String

Validation property

The full validator report (Nothing only when the check itself failed; see FatalError). For a file that could not be opened it is present, with ValidationReport.WasExamined False.

VB.NET

Public ReadOnly Property Validation As ValidationReport

C#

public ValidationReport Validation { get; }

Property value

ValidationReport

WasExamined property

False when the file could not be examined; ErrorCode then says why.

VB.NET

Public ReadOnly Property WasExamined As Boolean

C#

public bool WasExamined { get; }

Property value

Boolean

RepairTo(String, DiagnosticsContext, Boolean) method

Repair this file to outPath (damaged items are skipped and listed in the report's Losses; everything readable is rebuilt into a structurally-canonical PST). See PstRepair.Repair for the result codes: 0 is a clean repair, 15 a usable file with content missing, anything else a failure.

VB.NET

Public Function RepairTo(
    outPath As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional overwrite As Boolean = False
) As RepairReport

C#

public RepairReport RepairTo(string outPath, DiagnosticsContext diag = null, bool overwrite = false);

Parameters

outPath String
diag DiagnosticsContext
overwrite Boolean
Replace outPath if it exists. False by default, like every other operation that writes a file: this used to overwrite whatever was there without being asked.

Returns

RepairReport

SaveSupportReport(String, String, String) method

Write the developer support report (structural metadata only — no message content). outPath names the target file; when empty the report goes to the user's temp folder (or directory when supplied) as BastionPstSdk-SupportReport-<file>-<stamp>.txt. NEVER throws: check the returned result's ErrorCode (0 = written, .Path = where).

VB.NET

Public Function SaveSupportReport(
    Optional outPath As String = Nothing,
    Optional directory As String = Nothing,
    Optional contact As String = Nothing
) As FileOpResult

C#

public FileOpResult SaveSupportReport(string outPath = null, string directory = null, string contact = null);

Parameters

outPath String
directory String
contact String

Returns

FileOpResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace

PstHealth class

Namespace: Bastion.Pst.Validation · Assembly: Bastion.Pst.dll

One-call health check for a PST/OST: full structural validation surfaced as a simple corrupted/clean verdict, plus support-report generation and a repair shortcut.

VB.NET

Public NotInheritable Class PstHealth

C#

public sealed class PstHealth

Methods

NameDescription
Check(String, DiagnosticsContext, Boolean) staticValidate path structurally (pages, blocks, CRCs, B-trees, maps). Never throws. There are three outcomes: clean (ErrorCode 0, IsCorrupted False); damaged (ErrorCode 0, IsCorrupted True); and not examined, when the file is missing, locked or unreadable or the check was cancelled (ErrorCode says which, IsCorrupted False, WasExamined False). When diag is supplied, corruption is also surfaced through it (event + logs + auto support report per its settings); a file that could not be examined is noted, never raised as corrupt.

Details

Check(String, DiagnosticsContext, Boolean) method static

Validate path structurally (pages, blocks, CRCs, B-trees, maps). Never throws. There are three outcomes: clean (ErrorCode 0, IsCorrupted False); damaged (ErrorCode 0, IsCorrupted True); and not examined, when the file is missing, locked or unreadable or the check was cancelled (ErrorCode says which, IsCorrupted False, WasExamined False). When diag is supplied, corruption is also surfaced through it (event + logs + auto support report per its settings); a file that could not be examined is noted, never raised as corrupt.

VB.NET

Public Shared Function Check(
    path As String,
    Optional diag As DiagnosticsContext = Nothing,
    Optional stillReadable As Boolean = True
) As HealthResult

C#

public static HealthResult Check(string path, DiagnosticsContext diag = null, bool stillReadable = true);

Parameters

path String
diag DiagnosticsContext
stillReadable Boolean
Whether the caller is still going to read this source. Pass False when it has already been dropped, so the user is not told its content will be recovered when nothing will be read from it.

Returns

HealthResult

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace

PstValidator class

Namespace: Bastion.Pst.Validation · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class PstValidator

C#

public sealed class PstValidator

Methods

NameDescription
Validate(Stream) staticValidate an already-open seekable stream (does not close it).
Validate(Stream, DiagnosticsContext) staticValidate an already-open seekable stream, reporting progress (does not close it). A stream that is Nothing, or cannot seek, gives a "not examined" report with InvalidArgument; it does not throw.
Validate(String) staticValidate the PST at path; never throws. A malformed file is reported as issues (IsValid = False). A file that cannot be examined (missing, locked, access denied, an I/O error part-way) is reported as NOT EXAMINED: ValidationReport.WasExamined is False and ValidationReport.NotExaminedCode says why. It is not reported as damaged.
Validate(String, DiagnosticsContext) staticValidate the PST at path, reporting progress through diag as it reads, and stopping when its CancellationToken is cancelled (the report is then "not examined", code OperationCancelled). Never throws.

Details

Validate(Stream) method static

Validate an already-open seekable stream (does not close it).

VB.NET

Public Shared Function Validate(stream As Stream) As ValidationReport

C#

public static ValidationReport Validate(Stream stream);

Parameters

stream Stream

Returns

ValidationReport

Validate(Stream, DiagnosticsContext) method static

Validate an already-open seekable stream, reporting progress (does not close it). A stream that is Nothing, or cannot seek, gives a "not examined" report with InvalidArgument; it does not throw.

VB.NET

Public Shared Function Validate(stream As Stream, diag As DiagnosticsContext) As ValidationReport

C#

public static ValidationReport Validate(Stream stream, DiagnosticsContext diag);

Parameters

stream Stream
diag DiagnosticsContext

Returns

ValidationReport

Validate(String) method static

Validate the PST at path; never throws. A malformed file is reported as issues (IsValid = False). A file that cannot be examined (missing, locked, access denied, an I/O error part-way) is reported as NOT EXAMINED: ValidationReport.WasExamined is False and ValidationReport.NotExaminedCode says why. It is not reported as damaged.

VB.NET

Public Shared Function Validate(path As String) As ValidationReport

C#

public static ValidationReport Validate(string path);

Parameters

path String

Returns

ValidationReport

Validate(String, DiagnosticsContext) method static

Validate the PST at path, reporting progress through diag as it reads, and stopping when its CancellationToken is cancelled (the report is then "not examined", code OperationCancelled). Never throws.

VB.NET

Public Shared Function Validate(path As String, diag As DiagnosticsContext) As ValidationReport

C#

public static ValidationReport Validate(string path, DiagnosticsContext diag);

Parameters

path String
diag DiagnosticsContext

Returns

ValidationReport

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace

ValidationIssue class

Namespace: Bastion.Pst.Validation · Assembly: Bastion.Pst.dll

One structural problem found by PstValidator.

VB.NET

Public NotInheritable Class ValidationIssue

C#

public sealed class ValidationIssue

Constructors

NameDescription
ValidationIssue(ValidationSeverity, String, UInt64, String)

Properties

NameDescription
Category
Message
Offset
Severity

Methods

NameDescription
ToString()

Details

ValidationIssue(ValidationSeverity, String, UInt64, String) constructor

VB.NET

Public Sub New(
    sev As ValidationSeverity,
    category As String,
    offset As ULong,
    message As String
)

C#

public ValidationIssue(ValidationSeverity sev, string category, ulong offset, string message);

Parameters

sev ValidationSeverity
category String
offset UInt64
message String

Category property

VB.NET

Public ReadOnly Property Category As String

C#

public string Category { get; }

Property value

String

Message property

VB.NET

Public ReadOnly Property Message As String

C#

public string Message { get; }

Property value

String

Offset property

VB.NET

Public ReadOnly Property Offset As ULong

C#

public ulong Offset { get; }

Property value

UInt64

Severity property

VB.NET

Public ReadOnly Property Severity As ValidationSeverity

C#

public ValidationSeverity Severity { get; }

Property value

ValidationSeverity

ToString() method

VB.NET

Public Overrides Function ToString() As String

C#

public override string ToString();

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace

ValidationReport class

Namespace: Bastion.Pst.Validation · Assembly: Bastion.Pst.dll

Result of validating a PST: the issues found and how much was checked. There are three answers, not two. IsValid True: the file was examined and no error was found in what was examined (NotChecked lists what was not). IsValid False with WasExamined True: the file is damaged, and Issues says where. WasExamined False: the file could not be examined at all (missing, locked, access denied, an I/O error, cancelled) and nothing is known about its condition; NotExaminedCode says why. A file in that third state is not valid and is not damaged: do not offer it for repair.

VB.NET

Public NotInheritable Class ValidationReport

C#

public sealed class ValidationReport

Constructors

NameDescription
ValidationReport()

Properties

NameDescription
BlocksChecked
ErrorCount
Issues
IsValidTrue when the file was examined and no errors were found (warnings do not fail the gate). False for a file that could not be examined: it is not known to be valid. Test WasExamined before reading False as "damaged".
NotCheckedWhat the validator did NOT look at in this file, in plain words: structures it has no check for (subnode trees; the data trees of an Outlook 2013+ OST; the map pages of an ANSI store) and anything it had to pass over. IsValid says nothing about these. Empty only when nothing was left out.
NotExaminedCodeWhy the file was not examined; ErrorCode.Ok when it was.
NotExaminedReasonThe reason in words, fit to show a user; empty when the file was examined.
PagesChecked
WarningCount
WasExaminedFalse when the validator could not examine the file: it was missing, locked or access was denied, the read failed part-way, or the check was cancelled. The file's condition is then unknown; NotExaminedCode and NotExaminedReason say why.

Details

ValidationReport() constructor

VB.NET

Public Sub New()

C#

public ValidationReport();

BlocksChecked property

VB.NET

Public Property BlocksChecked As Integer

C#

public int BlocksChecked { get; set; }

Property value

Int32

ErrorCount property

VB.NET

Public ReadOnly Property ErrorCount As Integer

C#

public int ErrorCount { get; }

Property value

Int32

Issues property

VB.NET

Public ReadOnly Property Issues As IReadOnlyList(Of ValidationIssue)

C#

public IReadOnlyList<ValidationIssue> Issues { get; }

Property value

IReadOnlyList<ValidationIssue>

IsValid property

True when the file was examined and no errors were found (warnings do not fail the gate). False for a file that could not be examined: it is not known to be valid. Test WasExamined before reading False as "damaged".

VB.NET

Public ReadOnly Property IsValid As Boolean

C#

public bool IsValid { get; }

Property value

Boolean

NotChecked property

What the validator did NOT look at in this file, in plain words: structures it has no check for (subnode trees; the data trees of an Outlook 2013+ OST; the map pages of an ANSI store) and anything it had to pass over. IsValid says nothing about these. Empty only when nothing was left out.

VB.NET

Public ReadOnly Property NotChecked As IReadOnlyList(Of String)

C#

public IReadOnlyList<string> NotChecked { get; }

Property value

IReadOnlyList<String>

NotExaminedCode property

Why the file was not examined; ErrorCode.Ok when it was.

VB.NET

Public ReadOnly Property NotExaminedCode As ErrorCode

C#

public ErrorCode NotExaminedCode { get; }

Property value

ErrorCode

NotExaminedReason property

The reason in words, fit to show a user; empty when the file was examined.

VB.NET

Public ReadOnly Property NotExaminedReason As String

C#

public string NotExaminedReason { get; }

Property value

String

PagesChecked property

VB.NET

Public Property PagesChecked As Integer

C#

public int PagesChecked { get; set; }

Property value

Int32

WarningCount property

VB.NET

Public ReadOnly Property WarningCount As Integer

C#

public int WarningCount { get; }

Property value

Int32

WasExamined property

False when the validator could not examine the file: it was missing, locked or access was denied, the read failed part-way, or the check was cancelled. The file's condition is then unknown; NotExaminedCode and NotExaminedReason say why.

VB.NET

Public ReadOnly Property WasExamined As Boolean

C#

public bool WasExamined { get; }

Property value

Boolean

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace

ValidationSeverity enumeration

Namespace: Bastion.Pst.Validation · Assembly: Bastion.Pst.dll

VB.NET

Public Enum ValidationSeverity

C#

public enum ValidationSeverity

Members

NameValueDescription
Error0
Warning1

Bastion PST SDK 3.0.0 › API reference

Bastion.Pst.Views namespace

Assembly: Bastion.Pst.dll

Classes

NameDescription
AppointmentViewAn appointment as a calendar shows it.
AttachmentBytesResultThe bytes of one attachment, with the standard error contract (StoreViews.TryAttachmentBytes).
AttachmentViewOne attachment, as a reading pane lists it.
ContactMerger
ContactViewA contact as a card view shows it.
ItemDetailThe full detail of one item, for a reading pane or an item window.
ItemOps
ItemQuery
ItemQuery.RowFactsWhat the contents table can tell us about a row without opening it.
ItemViewBaseFields shared by every kind of item.
JournalViewA journal entry: a record of a telephone call, a meeting, a document worked on.
MailViewA message as a mail list shows it.
NoteViewA sticky note.
RssViewAn RSS feed post. Outlook files these under "RSS Feeds" with the container class IPF.Note.OutlookHomepage and the item class IPM.Post.Rss - close enough to mail to be mistaken for it, which is why they used to appear in the mail folder tree, but they are their own thing: a headline, a feed, a publication date and a link back to the article.
SaveReportWhat a save/export produced: the standard error contract plus the files written.
SectionFolderA folder belonging to a section — a calendar, a contact folder — for a host to list.
StoreViews
TaskViewA task as a to-do list shows it.

Enumerations

NameDescription
SaveFormatThe file an item is saved as when the user picks "Save As" with no format chosen.
SectionThe sections of a mailbox.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

AppointmentView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

An appointment as a calendar shows it.

VB.NET

Public NotInheritable Class AppointmentView
    Inherits ItemViewBase

C#

public sealed class AppointmentView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
AppointmentView()

Properties

NameDescription
Attendees
Body
BusyStatus
Display
EndTimeWhen the appointment ends (the first occurrence, for a recurring one): an instant, in UTC.
IsAllDay
IsRecurringTrue for a series: StartTime and EndTime are then those of its first occurrence only.
Location
OccurrenceKeyIdentity for spotting the same appointment archived twice: same subject, same start, same length. Used when merging calendars of the same name.
Organiser
ReminderSet
StartTimeWhen the appointment starts: an instant, in UTC. For a recurring appointment (IsRecurring) this is the start of its FIRST occurrence; the rest are in AppointmentItem.Recurrence.
Subject

Details

AppointmentView() constructor

VB.NET

Public Sub New()

C#

public AppointmentView();

Attendees property

VB.NET

Public Property Attendees As String

C#

public string Attendees { get; set; }

Property value

String

Body property

VB.NET

Public Property Body As String

C#

public string Body { get; set; }

Property value

String

BusyStatus property

VB.NET

Public Property BusyStatus As BusyStatus

C#

public BusyStatus BusyStatus { get; set; }

Property value

BusyStatus

Display property

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

EndTime property

When the appointment ends (the first occurrence, for a recurring one): an instant, in UTC.

VB.NET

Public Property EndTime As Date?

C#

public DateTime? EndTime { get; set; }

Property value

Nullable<DateTime>

IsAllDay property

VB.NET

Public Property IsAllDay As Boolean

C#

public bool IsAllDay { get; set; }

Property value

Boolean

IsRecurring property

True for a series: StartTime and EndTime are then those of its first occurrence only.

VB.NET

Public Property IsRecurring As Boolean

C#

public bool IsRecurring { get; set; }

Property value

Boolean

Location property

VB.NET

Public Property Location As String

C#

public string Location { get; set; }

Property value

String

OccurrenceKey property

Identity for spotting the same appointment archived twice: same subject, same start, same length. Used when merging calendars of the same name.

VB.NET

Public ReadOnly Property OccurrenceKey As String

C#

public string OccurrenceKey { get; }

Property value

String

Organiser property

VB.NET

Public Property Organiser As String

C#

public string Organiser { get; set; }

Property value

String

ReminderSet property

VB.NET

Public Property ReminderSet As Boolean

C#

public bool ReminderSet { get; set; }

Property value

Boolean

StartTime property

When the appointment starts: an instant, in UTC. For a recurring appointment (IsRecurring) this is the start of its FIRST occurrence; the rest are in AppointmentItem.Recurrence.

VB.NET

Public Property StartTime As Date?

C#

public DateTime? StartTime { get; set; }

Property value

Nullable<DateTime>

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

AttachmentBytesResult class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

The bytes of one attachment, with the standard error contract (StoreViews.TryAttachmentBytes).

VB.NET

Public NotInheritable Class AttachmentBytesResult
    Inherits OperationResult

C#

public sealed class AttachmentBytesResult : OperationResult

Inherits: OperationResult

Constructors

NameDescription
AttachmentBytesResult()

Properties

NameDescription
BytesThe attachment's bytes: an empty array for an attachment that holds none, and Nothing whenever OperationResult.ErrorCode is not Ok.

Details

AttachmentBytesResult() constructor

VB.NET

Public Sub New()

C#

public AttachmentBytesResult();

Bytes property

The attachment's bytes: an empty array for an attachment that holds none, and Nothing whenever OperationResult.ErrorCode is not Ok.

VB.NET

Public Property Bytes As Byte()

C#

public byte[] Bytes { get; set; }

Property value

Byte[]

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

AttachmentView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

One attachment, as a reading pane lists it.

VB.NET

Public NotInheritable Class AttachmentView

C#

public sealed class AttachmentView

Constructors

NameDescription
AttachmentView()

Properties

NameDescription
ContentId
FileName
Index
IsEmbeddedMessage
IsInlineTrue when the attachment is displayed inside the HTML body rather than listed (an inline image); a reading pane should not show it as a paperclip.
MimeTag
SizeBytes

Details

AttachmentView() constructor

VB.NET

Public Sub New()

C#

public AttachmentView();

ContentId property

VB.NET

Public Property ContentId As String

C#

public string ContentId { get; set; }

Property value

String

FileName property

VB.NET

Public Property FileName As String

C#

public string FileName { get; set; }

Property value

String

Index property

VB.NET

Public Property Index As Integer

C#

public int Index { get; set; }

Property value

Int32

IsEmbeddedMessage property

VB.NET

Public Property IsEmbeddedMessage As Boolean

C#

public bool IsEmbeddedMessage { get; set; }

Property value

Boolean

IsInline property

True when the attachment is displayed inside the HTML body rather than listed (an inline image); a reading pane should not show it as a paperclip.

VB.NET

Public Property IsInline As Boolean

C#

public bool IsInline { get; set; }

Property value

Boolean

MimeTag property

VB.NET

Public Property MimeTag As String

C#

public string MimeTag { get; set; }

Property value

String

SizeBytes property

VB.NET

Public Property SizeBytes As Integer

C#

public int SizeBytes { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ContactMerger class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class ContactMerger

C#

public sealed class ContactMerger

Methods

NameDescription
Combine(IEnumerable<ContactView>) static

Combine contact rows that are the same person. Order is preserved: the first entry seen for a person is the one kept and filled in from the rest.

The rows passed in are never modified. Folding is done into a copy, so a caller may hold its projected contacts and merge them again — which a host does on every folder or option change — without the second merge folding already-folded rows into themselves and running the "combined from N entries" count away with itself.

CombineByEmail(IEnumerable<ContactView>) static

Combine contacts that share an e-mail address, whatever their names say. Use with care and never silently: a shared address is not always one person — info@, support@ and a family address are all held by several people, and merging those would fuse unrelated contacts into one. Matching on name (Combine) is the safe default; this is the opt-in.

As with Combine, the rows passed in are never modified.

Details

Combine(IEnumerable<ContactView>) method static

Combine contact rows that are the same person. Order is preserved: the first entry seen for a person is the one kept and filled in from the rest.

The rows passed in are never modified. Folding is done into a copy, so a caller may hold its projected contacts and merge them again — which a host does on every folder or option change — without the second merge folding already-folded rows into themselves and running the "combined from N entries" count away with itself.

VB.NET

Public Shared Function Combine(rows As IEnumerable(Of ContactView)) As List(Of ContactView)

C#

public static List<ContactView> Combine(IEnumerable<ContactView> rows);

Parameters

rows IEnumerable<ContactView>

Returns

List<ContactView>

CombineByEmail(IEnumerable<ContactView>) method static

Combine contacts that share an e-mail address, whatever their names say. Use with care and never silently: a shared address is not always one person — info@, support@ and a family address are all held by several people, and merging those would fuse unrelated contacts into one. Matching on name (Combine) is the safe default; this is the opt-in.

As with Combine, the rows passed in are never modified.

VB.NET

Public Shared Function CombineByEmail(rows As IEnumerable(Of ContactView)) As List(Of ContactView)

C#

public static List<ContactView> CombineByEmail(IEnumerable<ContactView> rows);

Parameters

rows IEnumerable<ContactView>

Returns

List<ContactView>

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ContactView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

A contact as a card view shows it.

VB.NET

Public NotInheritable Class ContactView
    Inherits ItemViewBase

C#

public sealed class ContactView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
ContactView()

Properties

NameDescription
AllEmailsEvery e-mail address on the contact, primary first, blanks removed.
AlternateAddressesPostal addresses that differed between the entries ContactMerger combined: the first is in BusinessAddress or HomeAddress, the others are here.
AlternateDetailsOther details that differed between the combined entries, one per line as "Label: value" ("Company: Example Works", "Job title: Director"). The merge keeps the first value in the field itself and every differing one here, so nothing is lost to it.
AlternateEmails
AlternatePhones
AlternatePhotosPhotos, other than Photo, that the combined entries carried.
Anniversary
Birthday
BusinessAddress
BusinessFax
BusinessPhone
Company
Department
Display
EmailThe address to show when there is room for one.
Email1
Email2
Email3
FileUnder
FullName
GivenName
HomeAddress
HomePhone
IsDistributionListTrue when this row is a distribution list (a contact GROUP), not a person. An archive's contacts folder holds both, and a group has none of a person's fields — so a host that does not check this draws a card with every line blank.
JobTitle
MemberNamesThe members as one line, for a card that has room for a line and not a list.
MembersMembers of the group, when IsDistributionList is set.
MembershipSummaryWhat a group has in place of a job title: how many people are in it. Empty for a person, so a host can bind one label to it either way.
MergedFrom
MergedFromMemberCountMember count as the list itself reported it, used when the members could not be decoded but the count could.
MobilePhone
Notes
PhoneThe number to show when there is room for one: business, then mobile, then home — the order Outlook prefers on a card.
PhotoThe contact's photo (JPEG/PNG bytes) if the card carries one, else Nothing.
SortKeySurname-first key Outlook files contacts under. A group has no surname, so it files under its own name.
SourceFolders
Surname
WebPage

Methods

NameDescription
Clone()

An independent copy of this row.

ContactMerger folds several entries into one by writing into the row it keeps, so it clones first — otherwise it would edit the caller's rows, and a host that holds its projected contacts in memory and re-merges them (on a folder change, say) would fold already-folded rows into themselves over and over.

The lists are new lists over the same strings, so appending to a copy's AlternateEmails cannot reach the original. Photo and Members are shared by reference: both are read-only once projected, and copying a photo per merge would be pure waste.

Details

ContactView() constructor

VB.NET

Public Sub New()

C#

public ContactView();

AllEmails property

Every e-mail address on the contact, primary first, blanks removed.

VB.NET

Public ReadOnly Property AllEmails As IEnumerable(Of String)

C#

public IEnumerable<string> AllEmails { get; }

Property value

IEnumerable<String>

AlternateAddresses property

Postal addresses that differed between the entries ContactMerger combined: the first is in BusinessAddress or HomeAddress, the others are here.

VB.NET

Public Property AlternateAddresses As List(Of String)

C#

public List<string> AlternateAddresses { get; set; }

Property value

List<String>

AlternateDetails property

Other details that differed between the combined entries, one per line as "Label: value" ("Company: Example Works", "Job title: Director"). The merge keeps the first value in the field itself and every differing one here, so nothing is lost to it.

VB.NET

Public Property AlternateDetails As List(Of String)

C#

public List<string> AlternateDetails { get; set; }

Property value

List<String>

AlternateEmails property

VB.NET

Public Property AlternateEmails As List(Of String)

C#

public List<string> AlternateEmails { get; set; }

Property value

List<String>

AlternatePhones property

VB.NET

Public Property AlternatePhones As List(Of String)

C#

public List<string> AlternatePhones { get; set; }

Property value

List<String>

AlternatePhotos property

Photos, other than Photo, that the combined entries carried.

VB.NET

Public Property AlternatePhotos As List(Of Byte())

C#

public List<byte[]> AlternatePhotos { get; set; }

Property value

List<Byte[]>

Anniversary property

VB.NET

Public Property Anniversary As Date?

C#

public DateTime? Anniversary { get; set; }

Property value

Nullable<DateTime>

Birthday property

VB.NET

Public Property Birthday As Date?

C#

public DateTime? Birthday { get; set; }

Property value

Nullable<DateTime>

BusinessAddress property

VB.NET

Public Property BusinessAddress As String

C#

public string BusinessAddress { get; set; }

Property value

String

BusinessFax property

VB.NET

Public Property BusinessFax As String

C#

public string BusinessFax { get; set; }

Property value

String

BusinessPhone property

VB.NET

Public Property BusinessPhone As String

C#

public string BusinessPhone { get; set; }

Property value

String

Company property

VB.NET

Public Property Company As String

C#

public string Company { get; set; }

Property value

String

Department property

VB.NET

Public Property Department As String

C#

public string Department { get; set; }

Property value

String

Display property

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

Email property

The address to show when there is room for one.

VB.NET

Public ReadOnly Property Email As String

C#

public string Email { get; }

Property value

String

Email1 property

VB.NET

Public Property Email1 As String

C#

public string Email1 { get; set; }

Property value

String

Email2 property

VB.NET

Public Property Email2 As String

C#

public string Email2 { get; set; }

Property value

String

Email3 property

VB.NET

Public Property Email3 As String

C#

public string Email3 { get; set; }

Property value

String

FileUnder property

VB.NET

Public Property FileUnder As String

C#

public string FileUnder { get; set; }

Property value

String

FullName property

VB.NET

Public Property FullName As String

C#

public string FullName { get; set; }

Property value

String

GivenName property

VB.NET

Public Property GivenName As String

C#

public string GivenName { get; set; }

Property value

String

HomeAddress property

VB.NET

Public Property HomeAddress As String

C#

public string HomeAddress { get; set; }

Property value

String

HomePhone property

VB.NET

Public Property HomePhone As String

C#

public string HomePhone { get; set; }

Property value

String

IsDistributionList property

True when this row is a distribution list (a contact GROUP), not a person. An archive's contacts folder holds both, and a group has none of a person's fields — so a host that does not check this draws a card with every line blank.

VB.NET

Public Property IsDistributionList As Boolean

C#

public bool IsDistributionList { get; set; }

Property value

Boolean

JobTitle property

VB.NET

Public Property JobTitle As String

C#

public string JobTitle { get; set; }

Property value

String

MemberNames property

The members as one line, for a card that has room for a line and not a list.

VB.NET

Public ReadOnly Property MemberNames As String

C#

public string MemberNames { get; }

Property value

String

Members property

Members of the group, when IsDistributionList is set.

VB.NET

Public Property Members As List(Of DistListMember)

C#

public List<DistListMember> Members { get; set; }

Property value

List<DistListMember>

MembershipSummary property

What a group has in place of a job title: how many people are in it. Empty for a person, so a host can bind one label to it either way.

VB.NET

Public ReadOnly Property MembershipSummary As String

C#

public string MembershipSummary { get; }

Property value

String

MergedFrom property

VB.NET

Public Property MergedFrom As Integer

C#

public int MergedFrom { get; set; }

Property value

Int32

MergedFromMemberCount property

Member count as the list itself reported it, used when the members could not be decoded but the count could.

VB.NET

Public Property MergedFromMemberCount As Integer

C#

public int MergedFromMemberCount { get; set; }

Property value

Int32

MobilePhone property

VB.NET

Public Property MobilePhone As String

C#

public string MobilePhone { get; set; }

Property value

String

Notes property

VB.NET

Public Property Notes As String

C#

public string Notes { get; set; }

Property value

String

Phone property

The number to show when there is room for one: business, then mobile, then home — the order Outlook prefers on a card.

VB.NET

Public ReadOnly Property Phone As String

C#

public string Phone { get; }

Property value

String

Photo property

The contact's photo (JPEG/PNG bytes) if the card carries one, else Nothing.

VB.NET

Public Property Photo As Byte()

C#

public byte[] Photo { get; set; }

Property value

Byte[]

SortKey property

Surname-first key Outlook files contacts under. A group has no surname, so it files under its own name.

VB.NET

Public ReadOnly Property SortKey As String

C#

public string SortKey { get; }

Property value

String

SourceFolders property

VB.NET

Public Property SourceFolders As List(Of String)

C#

public List<string> SourceFolders { get; set; }

Property value

List<String>

Surname property

VB.NET

Public Property Surname As String

C#

public string Surname { get; set; }

Property value

String

WebPage property

VB.NET

Public Property WebPage As String

C#

public string WebPage { get; set; }

Property value

String

Clone() method

An independent copy of this row.

ContactMerger folds several entries into one by writing into the row it keeps, so it clones first — otherwise it would edit the caller's rows, and a host that holds its projected contacts in memory and re-merges them (on a folder change, say) would fold already-folded rows into themselves over and over.

The lists are new lists over the same strings, so appending to a copy's AlternateEmails cannot reach the original. Photo and Members are shared by reference: both are read-only once projected, and copying a photo per merge would be pure waste.

VB.NET

Public Function Clone() As ContactView

C#

public ContactView Clone();

Returns

ContactView

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ItemDetail class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

The full detail of one item, for a reading pane or an item window.

VB.NET

Public NotInheritable Class ItemDetail

C#

public sealed class ItemDetail

Constructors

NameDescription
ItemDetail()

Properties

NameDescription
Attachments
BodyHtmlThe HTML body, or "" when the message has none.
BodyPlainThe plain-text body, or "" — always populated when there is any body at all, so a host with no HTML renderer still has something to show.
Date
DisplayBcc
DisplayCc
DisplayTo
ErrorNothing when the whole item was read. Otherwise what could not be: with Unreadable set, the item would not open at all and the host shows this instead of a confidently blank message; without it, the item is here but a part of it (its recipients, an attachment, its formatted body) could not be read, and the host shows this beside what there is. Names places (node ids, attachment numbers), never content.
HasHtmlTrue when BodyHtml is real HTML from the message rather than a fallback. A host should render HTML when this is set and plain text otherwise.
IsHtmlFormatThe same fact said the way an e-mail object says it: this message is HTML format.
Kind
MessageClass
Nid
Recipients
SenderEmail
SenderName
Subject
UnreadableTrue when the item could not be opened at all: every other field is blank because nothing could be read, not because the item is blank.

Details

ItemDetail() constructor

VB.NET

Public Sub New()

C#

public ItemDetail();

Attachments property

VB.NET

Public Property Attachments As List(Of AttachmentView)

C#

public List<AttachmentView> Attachments { get; set; }

Property value

List<AttachmentView>

BodyHtml property

The HTML body, or "" when the message has none.

VB.NET

Public Property BodyHtml As String

C#

public string BodyHtml { get; set; }

Property value

String

BodyPlain property

The plain-text body, or "" — always populated when there is any body at all, so a host with no HTML renderer still has something to show.

VB.NET

Public Property BodyPlain As String

C#

public string BodyPlain { get; set; }

Property value

String

Date property

VB.NET

Public Property Date As Date?

C#

public DateTime? Date { get; set; }

Property value

Nullable<DateTime>

DisplayBcc property

VB.NET

Public Property DisplayBcc As String

C#

public string DisplayBcc { get; set; }

Property value

String

DisplayCc property

VB.NET

Public Property DisplayCc As String

C#

public string DisplayCc { get; set; }

Property value

String

DisplayTo property

VB.NET

Public Property DisplayTo As String

C#

public string DisplayTo { get; set; }

Property value

String

Error property

Nothing when the whole item was read. Otherwise what could not be: with Unreadable set, the item would not open at all and the host shows this instead of a confidently blank message; without it, the item is here but a part of it (its recipients, an attachment, its formatted body) could not be read, and the host shows this beside what there is. Names places (node ids, attachment numbers), never content.

VB.NET

Public Property Error As String

C#

public string Error { get; set; }

Property value

String

HasHtml property

True when BodyHtml is real HTML from the message rather than a fallback. A host should render HTML when this is set and plain text otherwise.

VB.NET

Public Property HasHtml As Boolean

C#

public bool HasHtml { get; set; }

Property value

Boolean

IsHtmlFormat property

The same fact said the way an e-mail object says it: this message is HTML format.

VB.NET

Public ReadOnly Property IsHtmlFormat As Boolean

C#

public bool IsHtmlFormat { get; }

Property value

Boolean

Kind property

VB.NET

Public Property Kind As ItemKind

C#

public ItemKind Kind { get; set; }

Property value

ItemKind

MessageClass property

VB.NET

Public Property MessageClass As String

C#

public string MessageClass { get; set; }

Property value

String

Nid property

VB.NET

Public Property Nid As UInteger

C#

public uint Nid { get; set; }

Property value

UInt32

Recipients property

VB.NET

Public Property Recipients As List(Of Recipient)

C#

public List<Recipient> Recipients { get; set; }

Property value

List<Recipient>

SenderEmail property

VB.NET

Public Property SenderEmail As String

C#

public string SenderEmail { get; set; }

Property value

String

SenderName property

VB.NET

Public Property SenderName As String

C#

public string SenderName { get; set; }

Property value

String

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Unreadable property

True when the item could not be opened at all: every other field is blank because nothing could be read, not because the item is blank.

VB.NET

Public Property Unreadable As Boolean

C#

public bool Unreadable { get; set; }

Property value

Boolean

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ItemOps class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class ItemOps

C#

public sealed class ItemOps

Methods

NameDescription
CopyItems(String, String, IEnumerable<UInt32>, String, String, String, DiagnosticsContext) staticCopy items from one store into a folder of another (or the same) store. Each item is exported to a .msg and imported into targetFolderPath, which is a FULL folder path ("Clients\Acme\Inbox") and is created if it is not there. The source is only ever read. Returns the rewritten target at targetOutPath, which the caller swaps in.
DeleteItems(String, String, String, ISet<UInt32>, DiagnosticsContext) staticDelete items from a folder, writing the result to outPath.
ImportFiles(String, String, String, IEnumerable<String>, DiagnosticsContext) staticImport files (.msg .eml .ics .vcf .mbox …) into a folder, given by its FULL path ("Clients\Acme\Inbox"; created if it is not there).
IsWritable(String) static
MoveItems(String, String, String, String, ISet<UInt32>, DiagnosticsContext) staticMove items between folders of the same store.
SaveItems(String, String, IEnumerable<UInt32>, String, SaveFormat, CancellationToken, Action<Int32>) staticSave items to disk in a format other applications can open: mail as .msg, contacts as .vcf, appointments as .ics, notes as .txt — or force one format for the lot. The source is opened read-only and never changed.
WhyNotWritable(String) staticWhy a store will not accept data, or "" when it will. A host should show this rather than inventing its own wording.

Details

CopyItems(String, String, IEnumerable<UInt32>, String, String, String, DiagnosticsContext) method static

Copy items from one store into a folder of another (or the same) store. Each item is exported to a .msg and imported into targetFolderPath, which is a FULL folder path ("Clients\Acme\Inbox") and is created if it is not there. The source is only ever read. Returns the rewritten target at targetOutPath, which the caller swaps in.

VB.NET

Public Shared Function CopyItems(
    sourcePath As String,
    sourceFolderPath As String,
    nids As IEnumerable(Of UInteger),
    targetPath As String,
    targetOutPath As String,
    targetFolderPath As String,
    diag As DiagnosticsContext
) As EditReport

C#

public static EditReport CopyItems(
    string sourcePath,
    string sourceFolderPath,
    IEnumerable<uint> nids,
    string targetPath,
    string targetOutPath,
    string targetFolderPath,
    DiagnosticsContext diag
);

Parameters

sourcePath String
sourceFolderPath String
nids IEnumerable<UInt32>
targetPath String
targetOutPath String
targetFolderPath String
diag DiagnosticsContext

Returns

EditReport

Remarks

WHAT IS CARRIED. The .msg holds every property of the item (see MessageExporter.ExportMsg), and the import writes every one of them into the target: named properties under the target store's own ids (a name the target does not have yet is added to its name map), every column of every recipient, every attachment with its properties, attached messages and OLE objects, and the item's own creation and modification times. Only what belongs to the store and not to the item is the target's own: the message size, and the row numbers of recipients and attachments. A property that cannot be carried (a type a .msg has no storage for, a named property the source's name map does not define) is recorded as a loss, which arrives here: the result is then ErrorCode.CompletedWithLosses and OperationResult.Losses names the property tags. (Until 11 Nov 2026 the import read back a dozen fields, and a copied contact arrived with no addresses.)

An item that cannot be read is left out and recorded; the others are copied and the result is ErrorCode.CompletedWithLosses. If none could be read, nothing is written and the result is an error.

DeleteItems(String, String, String, ISet<UInt32>, DiagnosticsContext) method static

Delete items from a folder, writing the result to outPath.

VB.NET

Public Shared Function DeleteItems(
    storePath As String,
    outPath As String,
    folderPath As String,
    nids As ISet(Of UInteger),
    diag As DiagnosticsContext
) As EditReport

C#

public static EditReport DeleteItems(
    string storePath,
    string outPath,
    string folderPath,
    ISet<uint> nids,
    DiagnosticsContext diag
);

Parameters

storePath String
outPath String
folderPath String
nids ISet<UInt32>
diag DiagnosticsContext

Returns

EditReport

Remarks

A node id that is not in the folder is recorded in OperationResult.Losses ("not found in the folder") and makes the result ErrorCode.CompletedWithLosses, even when none of them was found: asking for five deletions and getting two is not a plain success. EditReport.ItemsRequested is how many were asked for, EditReport.ItemsNotFound how many of them the folder did not hold, and EditReport.ItemsDeleted how many were deleted.

ImportFiles(String, String, String, IEnumerable<String>, DiagnosticsContext) method static

Import files (.msg .eml .ics .vcf .mbox …) into a folder, given by its FULL path ("Clients\Acme\Inbox"; created if it is not there).

VB.NET

Public Shared Function ImportFiles(
    storePath As String,
    outPath As String,
    folderPath As String,
    files As IEnumerable(Of String),
    diag As DiagnosticsContext
) As EditReport

C#

public static EditReport ImportFiles(
    string storePath,
    string outPath,
    string folderPath,
    IEnumerable<string> files,
    DiagnosticsContext diag
);

Parameters

storePath String
outPath String
folderPath String
files IEnumerable<String>
diag DiagnosticsContext

Returns

EditReport

Remarks

A file that cannot be read is left out, and recorded in OperationResult.Losses with its reason; the result is then ErrorCode.CompletedWithLosses.

IsWritable(String) method static

VB.NET

Public Shared Function IsWritable(storePath As String) As Boolean

C#

public static bool IsWritable(string storePath);

Parameters

storePath String

Returns

Boolean

MoveItems(String, String, String, String, ISet<UInt32>, DiagnosticsContext) method static

Move items between folders of the same store.

VB.NET

Public Shared Function MoveItems(
    storePath As String,
    outPath As String,
    fromFolderPath As String,
    toFolderPath As String,
    nids As ISet(Of UInteger),
    diag As DiagnosticsContext
) As EditReport

C#

public static EditReport MoveItems(
    string storePath,
    string outPath,
    string fromFolderPath,
    string toFolderPath,
    ISet<uint> nids,
    DiagnosticsContext diag
);

Parameters

storePath String
outPath String
fromFolderPath String
toFolderPath String
nids ISet<UInt32>
diag DiagnosticsContext

Returns

EditReport

Remarks

As DeleteItems: a node id not found in fromFolderPath is recorded and counted in EditReport.ItemsNotFound, and the result is ErrorCode.CompletedWithLosses.

SaveItems(String, String, IEnumerable<UInt32>, String, SaveFormat, CancellationToken, Action<Int32>) method static

Save items to disk in a format other applications can open: mail as .msg, contacts as .vcf, appointments as .ics, notes as .txt — or force one format for the lot. The source is opened read-only and never changed.

VB.NET

Public Shared Function SaveItems(
    storePath As String,
    folderPath As String,
    nids As IEnumerable(Of UInteger),
    targetDir As String,
    Optional format As SaveFormat = SaveFormat.Native,
    Optional cancel As CancellationToken = Nothing,
    Optional progress As Action(Of Integer) = Nothing
) As SaveReport

C#

public static SaveReport SaveItems(
    string storePath,
    string folderPath,
    IEnumerable<uint> nids,
    string targetDir,
    SaveFormat format = SaveFormat.Native,
    CancellationToken cancel = default,
    Action<int> progress = null
);

Parameters

storePath String
folderPath String
nids IEnumerable<UInt32>
targetDir String
format SaveFormat
cancel CancellationToken
progress Action<Int32>

Returns

SaveReport

Remarks

Never throws (a licence refusal aside). An item that cannot be read, or is not of the kind the forced format carries, is counted in SaveReport.Failed and recorded with its reason; the rest are saved. Each file is written under a temporary name and moved into place. A failure of the DESTINATION (disk full, access denied) stops the save with that error. An exception thrown by progress does not count against the item it was called for, which has been saved by then.

WhyNotWritable(String) method static

Why a store will not accept data, or "" when it will. A host should show this rather than inventing its own wording.

VB.NET

Public Shared Function WhyNotWritable(storePath As String) As String

C#

public static string WhyNotWritable(string storePath);

Parameters

storePath String

Returns

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ItemQuery class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class ItemQuery

C#

public sealed class ItemQuery

Constructors

NameDescription
ItemQuery()

Methods

NameDescription
BodyContains(String)Body contains text. Expensive: opens every surviving item.
DateBefore(DateTime)Item dated before until. Cheap.
DateFrom(DateTime)Item dated on or after from. Cheap.
HasClass(String)Message class starts with prefix ("IPM.Contact"). Cheap.
InFolder(String)Only look in this folder path (exact, case-insensitive).
InFolders(Func<String, Boolean>)Only look in folders whose full path satisfies predicate — the cheapest filter of all, since a folder that fails is never opened.
LargerThan(Int32)Item is larger than bytes. Cheap.
SenderContains(String)Sender name or address contains text. Cheap.
SubjectContains(String)Subject contains text. Cheap — read from the table row.
Take(Int32)Stop after n matches (0 = no limit).
TextContains(String)Subject OR sender contains text — what a search box means. Cheap.
Unread()Unread only. Cheap.
Where(Func<PstMessage, Boolean>)An arbitrary test against the opened item. Runs only for rows that passed every cheap criterion, so put anything the contents table can answer in the criteria above. It is called only for an item that could be opened; an item that could not is returned by the view untested, with ItemViewBase.ReadError set. An exception thrown by predicate (or by the predicate given to InFolders) is not caught: it ends the enumeration and reaches the caller.
WithAttachments()With attachments only. Cheap.

Details

ItemQuery() constructor

VB.NET

Public Sub New()

C#

public ItemQuery();

BodyContains(String) method

Body contains text. Expensive: opens every surviving item.

VB.NET

Public Function BodyContains(text As String) As ItemQuery

C#

public ItemQuery BodyContains(string text);

Parameters

text String

Returns

ItemQuery

DateBefore(DateTime) method

Item dated before until. Cheap.

VB.NET

Public Function DateBefore(until As Date) As ItemQuery

C#

public ItemQuery DateBefore(DateTime until);

Parameters

until DateTime

Returns

ItemQuery

DateFrom(DateTime) method

Item dated on or after from. Cheap.

VB.NET

Public Function DateFrom(from As Date) As ItemQuery

C#

public ItemQuery DateFrom(DateTime from);

Parameters

from DateTime

Returns

ItemQuery

HasClass(String) method

Message class starts with prefix ("IPM.Contact"). Cheap.

VB.NET

Public Function HasClass(prefix As String) As ItemQuery

C#

public ItemQuery HasClass(string prefix);

Parameters

prefix String

Returns

ItemQuery

InFolder(String) method

Only look in this folder path (exact, case-insensitive).

VB.NET

Public Function InFolder(path As String) As ItemQuery

C#

public ItemQuery InFolder(string path);

Parameters

path String

Returns

ItemQuery

InFolders(Func<String, Boolean>) method

Only look in folders whose full path satisfies predicate — the cheapest filter of all, since a folder that fails is never opened.

VB.NET

Public Function InFolders(predicate As Func(Of String, Boolean)) As ItemQuery

C#

public ItemQuery InFolders(Func<string, bool> predicate);

Parameters

predicate Func<String, Boolean>

Returns

ItemQuery

LargerThan(Int32) method

Item is larger than bytes. Cheap.

VB.NET

Public Function LargerThan(bytes As Integer) As ItemQuery

C#

public ItemQuery LargerThan(int bytes);

Parameters

bytes Int32

Returns

ItemQuery

SenderContains(String) method

Sender name or address contains text. Cheap.

VB.NET

Public Function SenderContains(text As String) As ItemQuery

C#

public ItemQuery SenderContains(string text);

Parameters

text String

Returns

ItemQuery

SubjectContains(String) method

Subject contains text. Cheap — read from the table row.

VB.NET

Public Function SubjectContains(text As String) As ItemQuery

C#

public ItemQuery SubjectContains(string text);

Parameters

text String

Returns

ItemQuery

Take(Int32) method

Stop after n matches (0 = no limit).

VB.NET

Public Function Take(n As Integer) As ItemQuery

C#

public ItemQuery Take(int n);

Parameters

n Int32

Returns

ItemQuery

TextContains(String) method

Subject OR sender contains text — what a search box means. Cheap.

VB.NET

Public Function TextContains(text As String) As ItemQuery

C#

public ItemQuery TextContains(string text);

Parameters

text String

Returns

ItemQuery

Unread() method

Unread only. Cheap.

VB.NET

Public Function Unread() As ItemQuery

C#

public ItemQuery Unread();

Returns

ItemQuery

Where(Func<PstMessage, Boolean>) method

An arbitrary test against the opened item. Runs only for rows that passed every cheap criterion, so put anything the contents table can answer in the criteria above. It is called only for an item that could be opened; an item that could not is returned by the view untested, with ItemViewBase.ReadError set. An exception thrown by predicate (or by the predicate given to InFolders) is not caught: it ends the enumeration and reaches the caller.

VB.NET

Public Function Where(predicate As Func(Of PstMessage, Boolean)) As ItemQuery

C#

public ItemQuery Where(Func<PstMessage, bool> predicate);

Parameters

predicate Func<PstMessage, Boolean>

Returns

ItemQuery

WithAttachments() method

With attachments only. Cheap.

VB.NET

Public Function WithAttachments() As ItemQuery

C#

public ItemQuery WithAttachments();

Returns

ItemQuery

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ItemQuery.RowFacts class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

What the contents table can tell us about a row without opening it.

VB.NET

Public NotInheritable Class RowFacts

C#

public sealed class RowFacts

Constructors

NameDescription
RowFacts()

Properties

NameDescription
Date
DisplayToWho the message was addressed to — what a Sent Items list shows.
HasAttachments
ImportancePidTagImportance (0 low, 1 normal, 2 high); 1 when the table has no such column.
IsUnread
MessageClass
Nid
Received
SenderEmail
SenderName
Sent
Size
Subject

Details

RowFacts() constructor

VB.NET

Public Sub New()

C#

public RowFacts();

Date property

VB.NET

Public ReadOnly Property Date As Date?

C#

public DateTime? Date { get; }

Property value

Nullable<DateTime>

DisplayTo property

Who the message was addressed to — what a Sent Items list shows.

VB.NET

Public Property DisplayTo As String

C#

public string DisplayTo { get; set; }

Property value

String

HasAttachments property

VB.NET

Public Property HasAttachments As Boolean

C#

public bool HasAttachments { get; set; }

Property value

Boolean

Importance property

PidTagImportance (0 low, 1 normal, 2 high); 1 when the table has no such column.

VB.NET

Public Property Importance As Integer

C#

public int Importance { get; set; }

Property value

Int32

IsUnread property

VB.NET

Public Property IsUnread As Boolean

C#

public bool IsUnread { get; set; }

Property value

Boolean

MessageClass property

VB.NET

Public Property MessageClass As String

C#

public string MessageClass { get; set; }

Property value

String

Nid property

VB.NET

Public Property Nid As UInteger

C#

public uint Nid { get; set; }

Property value

UInt32

Received property

VB.NET

Public Property Received As Date?

C#

public DateTime? Received { get; set; }

Property value

Nullable<DateTime>

SenderEmail property

VB.NET

Public Property SenderEmail As String

C#

public string SenderEmail { get; set; }

Property value

String

SenderName property

VB.NET

Public Property SenderName As String

C#

public string SenderName { get; set; }

Property value

String

Sent property

VB.NET

Public Property Sent As Date?

C#

public DateTime? Sent { get; set; }

Property value

Nullable<DateTime>

Size property

VB.NET

Public Property Size As Integer

C#

public int Size { get; set; }

Property value

Int32

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

ItemViewBase class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

Fields shared by every kind of item.

VB.NET

Public MustInherit Class ItemViewBase

C#

public abstract class ItemViewBase

Derived: AppointmentView, ContactView, JournalView, MailView, NoteView, RssView, TaskView

Properties

NameDescription
DisplayWhat a list shows when it has one line to spare.
FolderNameDisplay name of the folder holding the item ("Inbox").
FolderNidNode id of that folder — lets a host act on the item without re-walking the tree.
FolderPathFull path of the folder holding the item ("Top of Outlook data file\Inbox").
Kind
MessageClass
NidNode id of the item within its store — the handle for reopening it.
ReadErrorNothing when the whole row was read. Otherwise a sentence saying what could not be: the item itself would not open (the row then holds only what its folder lists about it), or particular fields could not be read and are blank here for that reason and not because the item has none. A host should mark such a row; it must not present its blank fields as the item's content. Never contains content of the item.
Size
StorePathFile path of the store the item came from; a host may have several open.

Details

Display property

What a list shows when it has one line to spare.

VB.NET

Public MustOverride ReadOnly Property Display As String

C#

public abstract string Display { get; }

Property value

String

FolderName property

Display name of the folder holding the item ("Inbox").

VB.NET

Public Property FolderName As String

C#

public string FolderName { get; set; }

Property value

String

FolderNid property

Node id of that folder — lets a host act on the item without re-walking the tree.

VB.NET

Public Property FolderNid As UInteger

C#

public uint FolderNid { get; set; }

Property value

UInt32

FolderPath property

Full path of the folder holding the item ("Top of Outlook data file\Inbox").

VB.NET

Public Property FolderPath As String

C#

public string FolderPath { get; set; }

Property value

String

Kind property

VB.NET

Public Property Kind As ItemKind

C#

public ItemKind Kind { get; set; }

Property value

ItemKind

MessageClass property

VB.NET

Public Property MessageClass As String

C#

public string MessageClass { get; set; }

Property value

String

Nid property

Node id of the item within its store — the handle for reopening it.

VB.NET

Public Property Nid As UInteger

C#

public uint Nid { get; set; }

Property value

UInt32

ReadError property

Nothing when the whole row was read. Otherwise a sentence saying what could not be: the item itself would not open (the row then holds only what its folder lists about it), or particular fields could not be read and are blank here for that reason and not because the item has none. A host should mark such a row; it must not present its blank fields as the item's content. Never contains content of the item.

VB.NET

Public Property ReadError As String

C#

public string ReadError { get; set; }

Property value

String

Size property

VB.NET

Public Property Size As Integer

C#

public int Size { get; set; }

Property value

Int32

StorePath property

File path of the store the item came from; a host may have several open.

VB.NET

Public Property StorePath As String

C#

public string StorePath { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

JournalView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

A journal entry: a record of a telephone call, a meeting, a document worked on.

VB.NET

Public NotInheritable Class JournalView
    Inherits ItemViewBase

C#

public sealed class JournalView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
JournalView()

Properties

NameDescription
BodyThe entry's notes, as plain text.
DisplayThe line a list shows for the entry: its subject, or "(no subject)".
DurationMinutesHow long the activity lasted, in minutes, as the entry records it.
EndTimeWhen the activity ended, or Nothing when the entry does not say.
EntryTypeWhat kind of entry it is, as Outlook names it ("Phone call", "Meeting").
StartTimeWhen the activity began, or Nothing when the entry does not say.
SubjectThe entry's subject, with any stored prefix marker removed.

Details

JournalView() constructor

VB.NET

Public Sub New()

C#

public JournalView();

Body property

The entry's notes, as plain text.

VB.NET

Public Property Body As String

C#

public string Body { get; set; }

Property value

String

Display property

The line a list shows for the entry: its subject, or "(no subject)".

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

DurationMinutes property

How long the activity lasted, in minutes, as the entry records it.

VB.NET

Public Property DurationMinutes As Integer

C#

public int DurationMinutes { get; set; }

Property value

Int32

EndTime property

When the activity ended, or Nothing when the entry does not say.

VB.NET

Public Property EndTime As Date?

C#

public DateTime? EndTime { get; set; }

Property value

Nullable<DateTime>

EntryType property

What kind of entry it is, as Outlook names it ("Phone call", "Meeting").

VB.NET

Public Property EntryType As String

C#

public string EntryType { get; set; }

Property value

String

StartTime property

When the activity began, or Nothing when the entry does not say.

VB.NET

Public Property StartTime As Date?

C#

public DateTime? StartTime { get; set; }

Property value

Nullable<DateTime>

Subject property

The entry's subject, with any stored prefix marker removed.

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

MailView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

A message as a mail list shows it.

VB.NET

Public NotInheritable Class MailView
    Inherits ItemViewBase

C#

public sealed class MailView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
MailView()

Properties

NameDescription
DateReceived if known, else sent — what Outlook sorts a mail list by.
Display
FromDisplayWho the row is from: the sender's name, their address if unnamed.
HasAttachments
Importance
IsHtmlFormatTrue when the message was written as HTML and should be rendered as HTML.
IsUnread
PreviewFirst line or so of the body, for the second/third line of a message list.
Received
SenderEmail
SenderName
Sent
SizeBytesSize in bytes — the name a size column usually binds to.
Subject
To

Details

MailView() constructor

VB.NET

Public Sub New()

C#

public MailView();

Date property

Received if known, else sent — what Outlook sorts a mail list by.

VB.NET

Public ReadOnly Property Date As Date?

C#

public DateTime? Date { get; }

Property value

Nullable<DateTime>

Display property

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

FromDisplay property

Who the row is from: the sender's name, their address if unnamed.

VB.NET

Public ReadOnly Property FromDisplay As String

C#

public string FromDisplay { get; }

Property value

String

HasAttachments property

VB.NET

Public Property HasAttachments As Boolean

C#

public bool HasAttachments { get; set; }

Property value

Boolean

Importance property

VB.NET

Public Property Importance As Integer

C#

public int Importance { get; set; }

Property value

Int32

IsHtmlFormat property

True when the message was written as HTML and should be rendered as HTML.

VB.NET

Public Property IsHtmlFormat As Boolean

C#

public bool IsHtmlFormat { get; set; }

Property value

Boolean

IsUnread property

VB.NET

Public Property IsUnread As Boolean

C#

public bool IsUnread { get; set; }

Property value

Boolean

Preview property

First line or so of the body, for the second/third line of a message list.

VB.NET

Public Property Preview As String

C#

public string Preview { get; set; }

Property value

String

Received property

VB.NET

Public Property Received As Date?

C#

public DateTime? Received { get; set; }

Property value

Nullable<DateTime>

SenderEmail property

VB.NET

Public Property SenderEmail As String

C#

public string SenderEmail { get; set; }

Property value

String

SenderName property

VB.NET

Public Property SenderName As String

C#

public string SenderName { get; set; }

Property value

String

Sent property

VB.NET

Public Property Sent As Date?

C#

public DateTime? Sent { get; set; }

Property value

Nullable<DateTime>

SizeBytes property

Size in bytes — the name a size column usually binds to.

VB.NET

Public ReadOnly Property SizeBytes As Integer

C#

public int SizeBytes { get; }

Property value

Int32

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

To property

VB.NET

Public Property To As String

C#

public string To { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

NoteView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

A sticky note.

VB.NET

Public NotInheritable Class NoteView
    Inherits ItemViewBase

C#

public sealed class NoteView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
NoteView()

Properties

NameDescription
Body
Colour
Created
Display
Subject

Details

NoteView() constructor

VB.NET

Public Sub New()

C#

public NoteView();

Body property

VB.NET

Public Property Body As String

C#

public string Body { get; set; }

Property value

String

Colour property

VB.NET

Public Property Colour As Integer

C#

public int Colour { get; set; }

Property value

Int32

Created property

VB.NET

Public Property Created As Date?

C#

public DateTime? Created { get; set; }

Property value

Nullable<DateTime>

Display property

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

RssView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

An RSS feed post. Outlook files these under "RSS Feeds" with the container class IPF.Note.OutlookHomepage and the item class IPM.Post.Rss - close enough to mail to be mistaken for it, which is why they used to appear in the mail folder tree, but they are their own thing: a headline, a feed, a publication date and a link back to the article.

VB.NET

Public NotInheritable Class RssView
    Inherits ItemViewBase

C#

public sealed class RssView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
RssView()

Properties

NameDescription
Author
Display
FeedNameThe feed the post came from - normally the folder it is filed in.
IsHtmlFormat
LinkLink back to the original article, when the post carries one.
Preview
Published
Subject

Details

RssView() constructor

VB.NET

Public Sub New()

C#

public RssView();

Author property

VB.NET

Public Property Author As String

C#

public string Author { get; set; }

Property value

String

Display property

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

FeedName property

The feed the post came from - normally the folder it is filed in.

VB.NET

Public Property FeedName As String

C#

public string FeedName { get; set; }

Property value

String

IsHtmlFormat property

VB.NET

Public Property IsHtmlFormat As Boolean

C#

public bool IsHtmlFormat { get; set; }

Property value

Boolean

Preview property

VB.NET

Public Property Preview As String

C#

public string Preview { get; set; }

Property value

String

Published property

VB.NET

Public Property Published As Date?

C#

public DateTime? Published { get; set; }

Property value

Nullable<DateTime>

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

SaveFormat enumeration

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

The file an item is saved as when the user picks "Save As" with no format chosen.

VB.NET

Public Enum SaveFormat

C#

public enum SaveFormat

Members

NameValueDescription
Native0Pick by item kind: mail/.msg, contact/.vcf, appointment/.ics, note/.txt.
Msg1Outlook item file (.msg) — every property of the item, for every kind.
Vcf2vCard (.vcf) — contacts, for any address book.
Ics3iCalendar (.ics) — appointments, for any calendar.
Txt4Plain text (.txt).

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

SaveReport class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

What a save/export produced: the standard error contract plus the files written.

VB.NET

Public NotInheritable Class SaveReport
    Inherits OperationResult

C#

public sealed class SaveReport : OperationResult

Inherits: OperationResult

Remarks

OperationResult.ErrorCode is ErrorCode.Ok when every item asked for was saved whole; ErrorCode.CompletedWithLosses when some were saved and some could not be, or one was saved with a part missing (each is in OperationResult.Losses with its reason); ErrorCode.OperationCancelled when the caller cancelled (the files saved before that are in Files and stay on disk); otherwise the failure that stopped it.

Constructors

NameDescription
SaveReport()

Properties

NameDescription
ErrorWhy the save as a whole failed or stopped, in words; Nothing when it ran to the end (even if individual items failed: see Failed). The same text as OperationResult.ErrorDescription in that case.
FailedItems that could not be saved. Each is a record in OperationResult.Losses, with the reason.
FilesThe files written, in the order they were saved.
OkTrue when the save ran to the end and every item was saved. Says the same as ErrorCode = Ok, except that an item saved with a part missing (an attachment that could not be read) leaves this True and makes the code ErrorCode.CompletedWithLosses: test the code.
SavedItems saved.
SkippedItems left out because the format asked for cannot express them, with nothing wrong with the item: an appointment with no start time cannot be written as an iCalendar event, which must have one. Not failures and not losses; Warnings says why.

Details

SaveReport() constructor

VB.NET

Public Sub New()

C#

public SaveReport();

Error property

Why the save as a whole failed or stopped, in words; Nothing when it ran to the end (even if individual items failed: see Failed). The same text as OperationResult.ErrorDescription in that case.

VB.NET

Public Property Error As String

C#

public string Error { get; set; }

Property value

String

Failed property

Items that could not be saved. Each is a record in OperationResult.Losses, with the reason.

VB.NET

Public Property Failed As Integer

C#

public int Failed { get; set; }

Property value

Int32

Files property

The files written, in the order they were saved.

VB.NET

Public Property Files As List(Of String)

C#

public List<string> Files { get; set; }

Property value

List<String>

Ok property

True when the save ran to the end and every item was saved. Says the same as ErrorCode = Ok, except that an item saved with a part missing (an attachment that could not be read) leaves this True and makes the code ErrorCode.CompletedWithLosses: test the code.

VB.NET

Public ReadOnly Property Ok As Boolean

C#

public bool Ok { get; }

Property value

Boolean

Saved property

Items saved.

VB.NET

Public Property Saved As Integer

C#

public int Saved { get; set; }

Property value

Int32

Skipped property

Items left out because the format asked for cannot express them, with nothing wrong with the item: an appointment with no start time cannot be written as an iCalendar event, which must have one. Not failures and not losses; Warnings says why.

VB.NET

Public Property Skipped As Integer

C#

public int Skipped { get; set; }

Property value

Int32

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

Section enumeration

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

The sections of a mailbox.

VB.NET

Public Enum Section

C#

public enum Section

Members

NameValueDescription
Mail0
Calendar1
Contacts2
Tasks3
Notes4
Journal5
Rss6Subscribed feeds ("RSS Feeds"), which Outlook stores as posts, not as mail.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

SectionFolder class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

A folder belonging to a section — a calendar, a contact folder — for a host to list.

VB.NET

Public NotInheritable Class SectionFolder

C#

public sealed class SectionFolder

Constructors

NameDescription
SectionFolder()

Properties

NameDescription
FullPath
ItemCount
Name
Nid
StorePath

Details

SectionFolder() constructor

VB.NET

Public Sub New()

C#

public SectionFolder();

FullPath property

VB.NET

Public Property FullPath As String

C#

public string FullPath { get; set; }

Property value

String

ItemCount property

VB.NET

Public Property ItemCount As Integer

C#

public int ItemCount { get; set; }

Property value

Int32

Name property

VB.NET

Public Property Name As String

C#

public string Name { get; set; }

Property value

String

Nid property

VB.NET

Public Property Nid As UInteger

C#

public uint Nid { get; set; }

Property value

UInt32

StorePath property

VB.NET

Public Property StorePath As String

C#

public string StorePath { get; set; }

Property value

String

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

StoreViews class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

VB.NET

Public NotInheritable Class StoreViews

C#

public sealed class StoreViews

Properties

NameDescription
EmptyEmailPlaceholder staticShown in place of a missing sender address (e.g. "empty@myaddress.com"). Purely a display substitution — the stored item is never changed. Empty shows nothing.
FoldersUnreadableHow many folders the most recent enumeration could not read in full: the list of the folder's items, or of its subfolders, was damaged, so items or folders beyond the fault are missing from the view. PstEvents.PstError is raised once for each. Reset as RowsWithReadErrors is.
HiddenFolderNames staticFolders Outlook keeps out of sight. They carry a contact container class but hold address-book plumbing rather than people — in a real archive they outnumbered the genuine contacts ten to one.
IncludeHiddenFoldersInclude Outlook's hidden address-book folders in contact views (default False).
RowsWithReadErrorsHow many rows of the most recent enumeration were returned with ItemViewBase.ReadError set: the item would not open, or some of its fields could not be read. Set to zero when an enumeration of Mail, Contacts, MailIn or any other view of this object STARTS, and final when it ends; two enumerations running at once share it.

Methods

NameDescription
Appointments(ItemQuery)Every appointment in the store.
AttachmentBytes(Folder, UInt32, Int32)The bytes of one attachment, by its index in ItemDetail.Attachments. A list row carries no payload — a mail list must not hold every attachment in memory — so a host asks for the bytes when the user actually saves or opens one.
Contacts(ItemQuery)Every contact in the store.
Detail(Folder, UInt32)Everything needed to display one item: body (HTML when it has one), recipients and attachments. Read one item at a time, when the user selects it — list rows stay thin.
Journal(ItemQuery)Every journal entry in the store (the items of its IPF.Journal folders). There was a Journal section and no view of it, and journal folders are kept out of Mail, so journal entries appeared in no view at all.
Mail(ItemQuery)Every mail item in the store.
MailIn(Folder, ItemQuery)The mail in ONE folder — what a mail list binds to when the user clicks a folder. Reads the folder's contents table and nothing else, so a 23,000-message Inbox costs one table read rather than 23,000 message opens.
Notes(ItemQuery)Every note in the store.
Rss(ItemQuery)Every RSS post in the store.
SectionFolders(Section)The folders that make up a section — the calendars, the contact folders — so a host can offer them as a list to switch between.
Tasks(ItemQuery)Every task in the store.
TryAttachmentBytes(Folder, UInt32, Int32)The bytes of one attachment, by its index in ItemDetail.Attachments, with the outcome. AttachmentBytesResult.Bytes is Nothing unless the code is ErrorCode.Ok. Never throws.

Details

EmptyEmailPlaceholder property static

Shown in place of a missing sender address (e.g. "empty@myaddress.com"). Purely a display substitution — the stored item is never changed. Empty shows nothing.

VB.NET

Public Shared Property EmptyEmailPlaceholder As String

C#

public static string EmptyEmailPlaceholder { get; set; }

Property value

String

FoldersUnreadable property

How many folders the most recent enumeration could not read in full: the list of the folder's items, or of its subfolders, was damaged, so items or folders beyond the fault are missing from the view. PstEvents.PstError is raised once for each. Reset as RowsWithReadErrors is.

VB.NET

Public ReadOnly Property FoldersUnreadable As Integer

C#

public int FoldersUnreadable { get; }

Property value

Int32

HiddenFolderNames property static

Folders Outlook keeps out of sight. They carry a contact container class but hold address-book plumbing rather than people — in a real archive they outnumbered the genuine contacts ten to one.

VB.NET

Public Shared ReadOnly Property HiddenFolderNames As HashSet(Of String)

C#

public static HashSet<string> HiddenFolderNames { get; }

Property value

HashSet<String>

IncludeHiddenFolders property

Include Outlook's hidden address-book folders in contact views (default False).

VB.NET

Public Property IncludeHiddenFolders As Boolean

C#

public bool IncludeHiddenFolders { get; set; }

Property value

Boolean

RowsWithReadErrors property

How many rows of the most recent enumeration were returned with ItemViewBase.ReadError set: the item would not open, or some of its fields could not be read. Set to zero when an enumeration of Mail, Contacts, MailIn or any other view of this object STARTS, and final when it ends; two enumerations running at once share it.

VB.NET

Public ReadOnly Property RowsWithReadErrors As Integer

C#

public int RowsWithReadErrors { get; }

Property value

Int32

Appointments(ItemQuery) method

Every appointment in the store.

VB.NET

Public Function Appointments(Optional query As ItemQuery = Nothing) As IEnumerable(Of AppointmentView)

C#

public IEnumerable<AppointmentView> Appointments(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<AppointmentView>

AttachmentBytes(Folder, UInt32, Int32) method

The bytes of one attachment, by its index in ItemDetail.Attachments. A list row carries no payload — a mail list must not hold every attachment in memory — so a host asks for the bytes when the user actually saves or opens one.

VB.NET

Public Function AttachmentBytes(folder As Folder, nid As UInteger, index As Integer) As Byte()

C#

public byte[] AttachmentBytes(Folder folder, uint nid, int index);

Parameters

folder Folder
nid UInt32
index Int32

Returns

Byte[]

The bytes (an empty array for an attachment that holds none), or Nothing when they could not be read; PstEvents.PstError is then raised with the reason. It used to return an empty array for every failure, which a host saved as a zero-byte file. TryAttachmentBytes returns the reason with the bytes.

Contacts(ItemQuery) method

Every contact in the store.

VB.NET

Public Function Contacts(Optional query As ItemQuery = Nothing) As IEnumerable(Of ContactView)

C#

public IEnumerable<ContactView> Contacts(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<ContactView>

Detail(Folder, UInt32) method

Everything needed to display one item: body (HTML when it has one), recipients and attachments. Read one item at a time, when the user selects it — list rows stay thin.

VB.NET

Public Function Detail(folder As Folder, nid As UInteger) As ItemDetail

C#

public ItemDetail Detail(Folder folder, uint nid);

Parameters

folder Folder
nid UInt32

Returns

ItemDetail

Remarks

Never throws. An item that will not open has ItemDetail.Unreadable set and ItemDetail.Error saying why. An item that opens but has a part that cannot be read (its recipients, an attachment, its formatted body) is returned with everything else and ItemDetail.Error naming the part.

Journal(ItemQuery) method

Every journal entry in the store (the items of its IPF.Journal folders). There was a Journal section and no view of it, and journal folders are kept out of Mail, so journal entries appeared in no view at all.

VB.NET

Public Function Journal(Optional query As ItemQuery = Nothing) As IEnumerable(Of JournalView)

C#

public IEnumerable<JournalView> Journal(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<JournalView>

Mail(ItemQuery) method

Every mail item in the store.

VB.NET

Public Function Mail(Optional query As ItemQuery = Nothing) As IEnumerable(Of MailView)

C#

public IEnumerable<MailView> Mail(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<MailView>

MailIn(Folder, ItemQuery) method

The mail in ONE folder — what a mail list binds to when the user clicks a folder. Reads the folder's contents table and nothing else, so a 23,000-message Inbox costs one table read rather than 23,000 message opens.

VB.NET

Public Function MailIn(folder As Folder, Optional query As ItemQuery = Nothing) As IEnumerable(Of MailView)

C#

public IEnumerable<MailView> MailIn(Folder folder, ItemQuery query = null);

Parameters

folder Folder
query ItemQuery

Returns

IEnumerable<MailView>

Notes(ItemQuery) method

Every note in the store.

VB.NET

Public Function Notes(Optional query As ItemQuery = Nothing) As IEnumerable(Of NoteView)

C#

public IEnumerable<NoteView> Notes(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<NoteView>

Rss(ItemQuery) method

Every RSS post in the store.

VB.NET

Public Function Rss(Optional query As ItemQuery = Nothing) As IEnumerable(Of RssView)

C#

public IEnumerable<RssView> Rss(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<RssView>

SectionFolders(Section) method

The folders that make up a section — the calendars, the contact folders — so a host can offer them as a list to switch between.

VB.NET

Public Function SectionFolders(section As Section) As List(Of SectionFolder)

C#

public List<SectionFolder> SectionFolders(Section section);

Parameters

section Section

Returns

List<SectionFolder>

Tasks(ItemQuery) method

Every task in the store.

VB.NET

Public Function Tasks(Optional query As ItemQuery = Nothing) As IEnumerable(Of TaskView)

C#

public IEnumerable<TaskView> Tasks(ItemQuery query = null);

Parameters

query ItemQuery

Returns

IEnumerable<TaskView>

TryAttachmentBytes(Folder, UInt32, Int32) method

The bytes of one attachment, by its index in ItemDetail.Attachments, with the outcome. AttachmentBytesResult.Bytes is Nothing unless the code is ErrorCode.Ok. Never throws.

VB.NET

Public Function TryAttachmentBytes(folder As Folder, nid As UInteger, index As Integer) As AttachmentBytesResult

C#

public AttachmentBytesResult TryAttachmentBytes(Folder folder, uint nid, int index);

Parameters

folder Folder
nid UInt32
index Int32

Returns

AttachmentBytesResult

Remarks

When the item has lost ANOTHER of its attachments, the one asked for is still returned with ErrorCode.Ok, and OperationResult.Warnings says what the item is missing.

Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace

TaskView class

Namespace: Bastion.Pst.Views · Assembly: Bastion.Pst.dll

A task as a to-do list shows it.

VB.NET

Public NotInheritable Class TaskView
    Inherits ItemViewBase

C#

public sealed class TaskView : ItemViewBase

Inherits: ItemViewBase

Constructors

NameDescription
TaskView()

Properties

NameDescription
Body
DateCompletedThe day the task was completed: a calendar day, as StartDate.
Display
DueDateThe day the task is due: a calendar day, as StartDate.
Importance
IsComplete
IsOverdue
Owner
PercentComplete
StartDateThe day work starts: a calendar day at midnight, of no Kind (the same day in every time zone). Do not convert it to local time.
Status
StatusText
Subject

Details

TaskView() constructor

VB.NET

Public Sub New()

C#

public TaskView();

Body property

VB.NET

Public Property Body As String

C#

public string Body { get; set; }

Property value

String

DateCompleted property

The day the task was completed: a calendar day, as StartDate.

VB.NET

Public Property DateCompleted As Date?

C#

public DateTime? DateCompleted { get; set; }

Property value

Nullable<DateTime>

Display property

VB.NET

Public Overrides ReadOnly Property Display As String

C#

public override string Display { get; }

Property value

String

DueDate property

The day the task is due: a calendar day, as StartDate.

VB.NET

Public Property DueDate As Date?

C#

public DateTime? DueDate { get; set; }

Property value

Nullable<DateTime>

Importance property

VB.NET

Public Property Importance As Importance

C#

public Importance Importance { get; set; }

Property value

Importance

IsComplete property

VB.NET

Public Property IsComplete As Boolean

C#

public bool IsComplete { get; set; }

Property value

Boolean

IsOverdue property

VB.NET

Public ReadOnly Property IsOverdue As Boolean

C#

public bool IsOverdue { get; }

Property value

Boolean

Owner property

VB.NET

Public Property Owner As String

C#

public string Owner { get; set; }

Property value

String

PercentComplete property

VB.NET

Public Property PercentComplete As Double

C#

public double PercentComplete { get; set; }

Property value

Double

StartDate property

The day work starts: a calendar day at midnight, of no Kind (the same day in every time zone). Do not convert it to local time.

VB.NET

Public Property StartDate As Date?

C#

public DateTime? StartDate { get; set; }

Property value

Nullable<DateTime>

Status property

VB.NET

Public Property Status As TaskStatus

C#

public TaskStatus Status { get; set; }

Property value

TaskStatus

StatusText property

VB.NET

Public Property StatusText As String

C#

public string StatusText { get; set; }

Property value

String

Subject property

VB.NET

Public Property Subject As String

C#

public string Subject { get; set; }

Property value

String