Bastion PST SDK 3.0.0
The guide and the complete API reference for Bastion.Pst.
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
ErrorCodeis0(Ok) on success, with anErrorDescriptionfit to show a user andToString()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
InvalidOperationExceptionwith 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.
| Outlook | Opens the files it writes |
|---|---|
| Outlook 97, 98, 2000, 2002/XP | No — these read only the legacy ANSI format |
| Outlook 2003, 2007, 2010, 2013, 2016, 2019, 2021, 2024 | Yes |
| 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.
| Build | For |
|---|---|
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-windows | Windows 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
| Namespace | For |
|---|---|
Bastion.Pst | Result types, ErrorCode, Licence, PstEvents |
Bastion.Pst.Messaging | Opening a store; folders, messages, attachments; search |
Bastion.Pst.Views | Bindable rows for an application, filters, item operations |
Bastion.Pst.Convert | Merge, split, convert, password |
Bastion.Pst.Validation, Bastion.Pst.Repair | Health check, validation, repair |
Bastion.Pst.Import, Bastion.Pst.Export | Interchange formats in and out; new empty stores |
Bastion.Pst.Authoring | Creating items and changing stores |
Bastion.Pst.Diagnostics | Progress, logs, cancellation, corruption recovery |
Product and support
| Website | bastionsoftwaresolutions.com/products/bastion-pst-sdk |
|---|---|
| Support | bastionsoftwaresolutions.com/support · support@bastionsoftwaresolutions.email |
| Licence | Software Licence Agreement |
This help documents the public API only.
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 UsingC#
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 SubC#
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 SubC#
// 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
- The cookbooks: tasks, each in VB.NET and C#.
- PersonalStorage, where reading starts, and the rest of the API reference.
- Questions and answers.
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 ' DiagnosticsContextC#
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| Cookbook | Recipes |
|---|---|
| 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 UsingC#
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 UsingC#
// 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 SubC#
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
NextC#
// 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
NextC#
// 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;
}
}Search a store
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 UsingC#
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 SubC#
// 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 IfC#
// 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 UsingC#
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
NextC#
// 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 UsingC#
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 UsingC#
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 IfC#
// 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
| Parameter | Default | Effect |
|---|---|---|
dedup | none | Pass 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. |
keepKinds | all | Only these item kinds. |
diag | none | Progress, the user log, cancellation, corruption recovery. |
overwrite | False | Replace the output file if it exists. |
maxBytes | 0 | Refuse output larger than this; 0 means the format's own limit. |
layout | Stacked | Stacked or Unified. |
rootName | “Stacked Merge” or “Unified Merge” | The name Outlook shows for the store; up to 200 characters. |
pruneEmpty | False | Leave 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. |
dropBlankMessages | True | Leave 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. |
verify | False | Re-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")
NextC#
// 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 IfC#
// 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")
NextC#
// 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 IfC#
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 IfC#
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.
| Format | Read | Into a PST | Out of a PST |
|---|---|---|---|
| EML (MIME) | EmlReader | StoreImporter.ImportFiles | MessageExporter.ExportEml, ExportFormat.Eml |
| MSG (Outlook) | MsgReader | StoreImporter.ImportFiles | MessageExporter.ExportMsg, ExportFormat.Msg |
| OFT (Outlook template) | — | — | MessageExporter.ExportOft |
| MHTML | — | — | MessageExporter.ExportMhtml, ExportFormat.Mhtml |
| MBOX | MboxReader | StoreImporter.ImportMbox | ExportFormat.Mbox |
| ICS (iCalendar) | IcsReader | ItemOps.ImportFiles | ItemExporter.ExportIcs, ExportFormat.Ics |
| VCF (vCard) | VcfReader | ItemOps.ImportFiles | ItemExporter.ExportVcf, ExportFormat.Vcf |
| OLM (Outlook for Mac) | OlmReader | StoreImporter.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
NextC#
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 attachmentRead 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
NextC#
// 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
NextC#
// 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 readImport 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 IfC#
// 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 appliedC#
// 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 appliedMake 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 UsingC#
// 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 SelectC#
// 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 UsingC#
// 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 IfC#
// 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 IfC#
// 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:
- 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.
- A developer licence on this computer, activated in Bastion Licence Manager.
- 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 SubC#
// 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 TryC#
// 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 TryC#
// 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 asnet8.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
$nullor 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-Objectruns after each item has been read. Pass anItemQuerytoViews.Mailand rows are rejected before any item is opened (Filter before an item is opened).
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.
| Sample | What it does |
|---|---|
ReadInbox | Opens 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. |
MergeTwoPstFiles | Merges 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:
| Solution | Visual Studio | Builds for |
|---|---|---|
<Sample>.VS2019.sln | 2017 and 2019 | .NET Framework 4.8 |
<Sample>.VS2022.sln | 2022 | .NET Framework 4.8 and .NET 8 |
<Sample>.VS2026.sln | 2026 | .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.
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.
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.
| Namespace | Types | Contents |
|---|---|---|
| Bastion.Pst | 14 | ErrorCode, FileOpResult, GenericResult, Licence, LossKind, LossRecord, … |
| Bastion.Pst.Authoring | 12 | AppointmentBuilder, Author, AuthoringSession, ContactBuilder, DistListBuilder, ItemBuilder, … |
| Bastion.Pst.Convert | 23 | Dedup, DestinationExistsException, EditReport, ItemEdit, MergeLayout, MergePreflight, … |
| Bastion.Pst.Diagnostics | 11 | ActivityEventArgs, AnsiUpgradeEventArgs, CorruptionEventArgs, DiagEventArgs, DiagnosticsContext, DiagPhase, … |
| Bastion.Pst.Export | 7 | ExportFormat, ExportReport, ItemExporter, MessageExporter, StoreBuilder, StoreExporter, … |
| Bastion.Pst.Import | 28 | EmlReader, IcsReader, ImportedAddress, ImportedAppointment, ImportedAttachment, ImportedContact, … |
| Bastion.Pst.Messaging | 37 | AppointmentItem, AppointmentRecurrence, Attachment, AttachMethod, BusyStatus, ContactItem, … |
| Bastion.Pst.Ndb | 1 | PstFormat |
| Bastion.Pst.Repair | 2 | PstRepair, RepairReport |
| Bastion.Pst.Validation | 6 | HealthResult, PstHealth, PstValidator, ValidationIssue, ValidationReport, ValidationSeverity |
| Bastion.Pst.Views | 20 | AppointmentView, AttachmentBytesResult, AttachmentView, ContactMerger, ContactView, ItemDetail, … |
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst namespace
Classes
| Name | Description |
|---|---|
FileOpResult | Result of a file-producing call (e.g. SaveSupportReport): the path plus the error contract. |
GenericResult | Result for operations with no extra payload (e.g. ConvertToUnicode). |
Licence | Licensing of Bastion Pst Sdk inside an application you distribute. |
LossRecord | One thing an operation could not read or carry into its output. |
OperationResult | Base of every operation result: error code + descriptions + ToString "code: description". |
PstCloseEventArgs | |
PstErrorEventArgs | |
PstEvents | Subscribe to Default to observe PST activity across the whole library. |
PstFolderSelectedEventArgs | |
PstOpenEventArgs | |
PstReadEventArgs | |
Settings | Library-wide settings. Each applies to every operation started after it is changed. |
Enumerations
| Name | Description |
|---|---|
ErrorCode | Failure classes returned by every Bastion PST SDK operation. 0 = success. |
LossKind | What 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
Failure classes returned by every Bastion PST SDK operation. 0 = success.
VB.NET
Public Enum ErrorCodeC#
public enum ErrorCodeMembers
| Name | Value | Description |
|---|---|---|
Ok | 0 | Success. |
UnknownError | 1 | Unclassified failure — see ErrorDescription/Detail. |
FileNotFound | 2 | A source or destination path does not exist. |
FileLocked | 3 | A file is locked by another process (commonly: the PST is mounted in Outlook). |
DiskFull | 4 | The destination disk is full (or ran out of space mid-write). |
AccessDenied | 5 | Access denied (permissions/read-only). |
InvalidPstFormat | 6 | The file is not a readable PST/OST (bad header/structure beyond recovery). |
DestinationExists | 7 | The destination already exists and overwrite was not requested. |
OutputSizeExceeded | 8 | The output would exceed the requested size cap. |
InvalidArgument | 9 | An argument was invalid (bad path, empty source list, …). |
InvalidRootName | 10 | The requested store root name is invalid (empty after sanitising / too long). |
NodeIdCapacityExceeded | 11 | The merge exceeds a single PST's node-id capacity — split into volumes instead. |
InsufficientDiskSpace | 12 | Disk free space is too low to start the operation safely. |
AnsiUpgradeRequired | 13 | The 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. |
OperationCancelled | 14 | The caller cancelled the operation via DiagnosticsContext.CancellationToken. The atomic-write model means nothing partial was left behind — the destination is untouched. |
CompletedWithLosses | 15 | The 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. |
OutputInvalid | 16 | The operation wrote a file, but the file failed the structural check that follows, or could not be reopened. Do not use it. |
OutOfMemory | 17 | The process ran out of memory. Closing other programs, or running the operation as a 64-bit process, may let it finish. |
VerificationFailed | 18 | The 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. |
InvalidInputFile | 19 | A 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
Result of a file-producing call (e.g. SaveSupportReport): the path plus the error contract.
VB.NET
Public NotInheritable Class FileOpResult
Inherits OperationResultC#
public sealed class FileOpResult : OperationResultConstructors
| Name | Description |
|---|---|
FileOpResult() |
Properties
| Name | Description |
|---|---|
Path | Full 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 StringC#
public string Path { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
GenericResult class
Result for operations with no extra payload (e.g. ConvertToUnicode).
VB.NET
Public NotInheritable Class GenericResult
Inherits OperationResultC#
public sealed class GenericResult : OperationResultConstructors
| Name | Description |
|---|---|
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
Licensing of Bastion Pst Sdk inside an application you distribute.
VB.NET
Public NotInheritable Class LicenceC#
public sealed class LicenceMethods
| Name | Description |
|---|---|
SetRuntimeKey(String) 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. |
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
runtimeKeyString
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
LossKind enumeration
What kind of thing an operation could not read or carry into its output.
VB.NET
Public Enum LossKindC#
public enum LossKindMembers
| Name | Value | Description |
|---|---|---|
Other | 0 | Something that fits no other kind; see the record's Location and Reason. |
Source | 1 | A whole source file was left out. |
Folder | 2 | A folder, or everything beneath it. |
Table | 3 | A 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. |
Message | 4 | A message or other item (contact, appointment, task, note). |
Attachment | 5 | An attachment, or an item's recipient list. |
Property | 6 | One property of an item, such as its body. |
Node | 7 | A low-level node or data block that could not be attributed to an item. |
Checksum | 8 | Data 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
One thing an operation could not read or carry into its output.
VB.NET
Public NotInheritable Class LossRecordC#
public sealed class LossRecordProperties
| Name | Description |
|---|---|
ExceptionType | The type name of the exception behind it, for support; empty when there was none. |
Kind | What kind of thing was lost. |
Location | Where in that file: a folder path, or a node id such as "node 0x00200024". Never message content. |
Reason | Why it could not be read, in one line. |
Source | The source file it belonged to, when known; otherwise empty. |
Methods
| Name | Description |
|---|---|
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 StringC#
public string ExceptionType { get; }Property value
String
Kind property
What kind of thing was lost.
Property value
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 StringC#
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 StringC#
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 StringC#
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
OperationResult class
Base of every operation result: error code + descriptions + ToString "code: description".
VB.NET
Public MustInherit Class OperationResultC#
public abstract class OperationResultProperties
| Name | Description |
|---|---|
Detail | Full technical detail (exception text incl. stack trace) — for logs/support, may be empty. |
ErrorCode | 0 (Ok) = success; otherwise the failure class. |
ErrorDescription | One-line, human-readable reason. "OK" on success. |
LossCount | How many things could not be read or carried. Zero when nothing was lost. |
Losses | 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. |
OutputWritten | 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. |
Succeeded | True when ErrorCode = Ok. |
Warnings | Things the caller should know that lost no data, in plain language. |
Methods
| Name | Description |
|---|---|
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 StringC#
public string Detail { get; set; }Property value
String
ErrorCode property
0 (Ok) = success; otherwise the failure class.
Property value
ErrorDescription property
One-line, human-readable reason. "OK" on success.
VB.NET
Public Property ErrorDescription As StringC#
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 IntegerC#
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 BooleanC#
public bool OutputWritten { get; }Property value
Boolean
Succeeded property
True when ErrorCode = Ok.
VB.NET
Public Overridable ReadOnly Property Succeeded As BooleanC#
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
PstCloseEventArgs class
VB.NET
Public NotInheritable Class PstCloseEventArgs
Inherits EventArgsC#
public sealed class PstCloseEventArgs : EventArgsConstructors
| Name | Description |
|---|---|
PstCloseEventArgs(String) |
Properties
| Name | Description |
|---|---|
Path |
Details
PstCloseEventArgs(String) constructor
VB.NET
Public Sub New(path As String)C#
public PstCloseEventArgs(string path);Parameters
pathString
Path property
VB.NET
Public ReadOnly Property Path As StringC#
public string Path { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
PstErrorEventArgs class
VB.NET
Public NotInheritable Class PstErrorEventArgs
Inherits EventArgsC#
public sealed class PstErrorEventArgs : EventArgsConstructors
| Name | Description |
|---|---|
PstErrorEventArgs(ErrorCode, String, String) |
Properties
| Name | Description |
|---|---|
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
codeErrorCodemessageStringpathString
ErrorCode property
Property value
Message property
VB.NET
Public ReadOnly Property Message As StringC#
public string Message { get; }Property value
String
Path property
VB.NET
Public ReadOnly Property Path As StringC#
public string Path { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
PstEvents class
Subscribe to Default to observe PST activity across the whole library.
VB.NET
Public NotInheritable Class PstEventsC#
public sealed class PstEventsConstructors
| Name | Description |
|---|---|
PstEvents() |
Properties
| Name | Description |
|---|---|
Default static | The single, process-wide event source. Accessible from any app. |
Events
| Name | Description |
|---|---|
PstClose | A store was closed (disposed). |
PstError | Something went wrong — carries an error code and message. |
PstFolderSelected | A folder's items were read — carries the item count. |
PstOpen | A PST/OST store was opened. |
PstRead | Progress 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 PstEventsC#
public static PstEvents Default { get; }Property value
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
VB.NET
Public NotInheritable Class PstFolderSelectedEventArgs
Inherits EventArgsC#
public sealed class PstFolderSelectedEventArgs : EventArgsConstructors
| Name | Description |
|---|---|
PstFolderSelectedEventArgs(String, String, Int64) |
Properties
| Name | Description |
|---|---|
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
pathStringfolderStringitemCountInt64
Folder property
VB.NET
Public ReadOnly Property Folder As StringC#
public string Folder { get; }Property value
String
ItemCount property
VB.NET
Public ReadOnly Property ItemCount As LongC#
public long ItemCount { get; }Property value
Int64
Path property
VB.NET
Public ReadOnly Property Path As StringC#
public string Path { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
PstOpenEventArgs class
VB.NET
Public NotInheritable Class PstOpenEventArgs
Inherits EventArgsC#
public sealed class PstOpenEventArgs : EventArgsConstructors
| Name | Description |
|---|---|
PstOpenEventArgs(String) |
Properties
| Name | Description |
|---|---|
Path |
Details
PstOpenEventArgs(String) constructor
VB.NET
Public Sub New(path As String)C#
public PstOpenEventArgs(string path);Parameters
pathString
Path property
VB.NET
Public ReadOnly Property Path As StringC#
public string Path { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
PstReadEventArgs class
VB.NET
Public NotInheritable Class PstReadEventArgs
Inherits EventArgsC#
public sealed class PstReadEventArgs : EventArgsConstructors
| Name | Description |
|---|---|
PstReadEventArgs(String, String, Int64, Int64) |
Properties
| Name | Description |
|---|---|
Current | |
Folder | |
Path | |
Percent | Percent 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
pathStringfolderStringcurrentInt64totalInt64
Current property
VB.NET
Public ReadOnly Property Current As LongC#
public long Current { get; }Property value
Int64
Folder property
VB.NET
Public ReadOnly Property Folder As StringC#
public string Folder { get; }Property value
String
Path property
VB.NET
Public ReadOnly Property Path As StringC#
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 IntegerC#
public int Percent { get; }Property value
Int32
Total property
VB.NET
Public ReadOnly Property Total As LongC#
public long Total { get; }Property value
Int64
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst namespace
Settings class
Library-wide settings. Each applies to every operation started after it is changed.
VB.NET
Public NotInheritable Class SettingsC#
public sealed class SettingsProperties
| Name | Description |
|---|---|
TempFolder 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. |
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 StringC#
public static string TempFolder { get; set; }Property value
String
Exceptions
| Exception | Condition |
|---|---|
ArgumentException | The 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
Classes
| Name | Description |
|---|---|
AppointmentBuilder | |
Author | 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. |
AuthoringSession | Accumulates 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 | |
ItemBuilder | Entry point for building typed items: ItemBuilder.Mail(), .Appointment(), .Contact(), .Task(), .Note(). |
ItemBuilderBase | Shared surface: subject/body/attachments and the terminal Build. |
JournalBuilder | |
MailBuilder | |
NoteBuilder | |
RssBuilder | An RSS feed item (IPM.Post.Rss). |
TaskBuilder |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
AppointmentBuilder class
VB.NET
Public NotInheritable Class AppointmentBuilder
Inherits ItemBuilderBaseC#
public sealed class AppointmentBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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
With 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 AppointmentBuilderC#
public AppointmentBuilder AllDay(bool value = true);Parameters
valueBoolean
Returns
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 AppointmentBuilderC#
public AppointmentBuilder Attendee(string name, string email);Parameters
nameStringemailString
Returns
BodyText(String) method
VB.NET
Public Function BodyText(s As String) As AppointmentBuilderC#
public AppointmentBuilder BodyText(string s);Parameters
sString
Returns
BusyStatus(Int32) method
0 free, 1 tentative, 2 busy, 3 out of office.
VB.NET
Public Function BusyStatus(status As Integer) As AppointmentBuilderC#
public AppointmentBuilder BusyStatus(int status);Parameters
statusInt32
Returns
EndsAt(DateTime) method
When the appointment ends. Read as StartsAt reads its Date.
VB.NET
Public Function EndsAt(d As Date) As AppointmentBuilderC#
public AppointmentBuilder EndsAt(DateTime d);Parameters
dDateTime
Returns
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 AppointmentBuilderC#
public AppointmentBuilder ExcludeOccurrences(params DateTime[] dates);Parameters
datesDateTime[]
Returns
Exceptions
| Exception | Condition |
|---|---|
ArgumentNullException | dates is Nothing. |
InvalidOperationException | The 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 AppointmentBuilderC#
public AppointmentBuilder InTimeZone(string timeZoneId);Parameters
timeZoneIdString- A Windows time zone id ("Eastern Standard Time") or an IANA id ("America/New_York"); "UTC" for none.
Returns
Exceptions
| Exception | Condition |
|---|---|
ArgumentException | The id is empty, or names no time zone this computer knows. |
Location(String) method
VB.NET
Public Function Location(s As String) As AppointmentBuilderC#
public AppointmentBuilder Location(string s);Parameters
sString
Returns
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 AppointmentBuilderC#
public AppointmentBuilder ModifyOccurrence(
DateTime originalDate,
DateTime? newStart = null,
DateTime? newEnd = null,
string newSubject = null,
string newLocation = null,
int? newBusyStatus = null
);Parameters
originalDateDateTimenewStartNullable<DateTime>newEndNullable<DateTime>newSubjectStringnewLocationStringnewBusyStatusNullable<Int32>
Returns
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 AppointmentBuilderC#
public AppointmentBuilder OptionalAttendee(string name, string email);Parameters
nameStringemailString
Returns
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 AppointmentBuilderC#
public AppointmentBuilder Organiser(string name, string email);Parameters
nameStringemailString
Returns
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 AppointmentBuilderC#
public AppointmentBuilder RecurDaily(int interval = 1, int occurrences = 0, DateTime? until = null);Parameters
intervalInt32occurrencesInt32untilNullable<DateTime>
Returns
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 AppointmentBuilderC#
public AppointmentBuilder RecurMonthly(
int dayOfMonth,
int interval = 1,
int occurrences = 0,
DateTime? until = null
);Parameters
dayOfMonthInt32intervalInt32occurrencesInt32untilNullable<DateTime>
Returns
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 AppointmentBuilderC#
public AppointmentBuilder RecurWeekly(
RecurDays days,
int interval = 1,
int occurrences = 0,
DateTime? until = null
);Parameters
daysRecurDaysintervalInt32occurrencesInt32untilNullable<DateTime>
Returns
Reminder(Int32) method
VB.NET
Public Function Reminder(minutesBefore As Integer) As AppointmentBuilderC#
public AppointmentBuilder Reminder(int minutesBefore);Parameters
minutesBeforeInt32
Returns
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 AppointmentBuilderC#
public AppointmentBuilder StartsAt(DateTime d);Parameters
dDateTime
Returns
Subject(String) method
VB.NET
Public Function Subject(s As String) As AppointmentBuilderC#
public AppointmentBuilder Subject(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
Author class
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 AuthorC#
public sealed class AuthorMethods
| Name | Description |
|---|---|
AddItems(String, String, IEnumerable<ImportedMessage>, String, DiagnosticsContext, Boolean, String) 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. |
AddItemsByFolder(String, String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, DiagnosticsContext, Boolean, String) 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). |
CreateFolder(String, String, String, DiagnosticsContext, Boolean) 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. |
CreateStore(String, String, Boolean) static | Create a new empty Unicode PST at path. |
CreateStoreWith(String, IEnumerable<ImportedMessage>, String, String, Boolean, DiagnosticsContext) static | Create 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) 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. |
DeleteFolder(String, String, String, Boolean, DiagnosticsContext, Boolean) static | Delete the folder at folderPath. When recursive is False, refuses a non-empty folder. |
DeleteItems(String, String, String, Func<PstMessage, Boolean>, DiagnosticsContext, Boolean) static | Delete items in folderPath matching match (Nothing = all items in the folder), writing to outPath. |
EditItems(String, String, String, Func<PstMessage, Boolean>, ItemEdit, DiagnosticsContext, Boolean) 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. |
MoveFolder(String, String, String, String, DiagnosticsContext, Boolean) static | Move the folder at folderPath under a new parent folder newParentPath, writing to outPath. |
MoveItems(String, String, String, Func<PstMessage, Boolean>, String, DiagnosticsContext, Boolean) 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. |
RemoveAttachments(String, String, String, Func<PstMessage, Boolean>, Func<Attachment, Boolean>, DiagnosticsContext, Boolean) 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. |
RenameFolder(String, String, String, String, DiagnosticsContext, Boolean) static | Rename the folder at folderPath to newName, writing to outPath. |
SetFolderClass(String, String, String, String, DiagnosticsContext, Boolean) static | Set 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 ImportReportC#
public static ImportReport AddItems(
string storePath,
string outPath,
IEnumerable<ImportedMessage> items,
string folderPath = "Authored",
DiagnosticsContext diag = null,
bool overwrite = true,
string storeName = null
);Parameters
storePathStringoutPathStringitemsIEnumerable<ImportedMessage>folderPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
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
storePathStringoutPathStringitemsIEnumerable<ImportedMessage>defaultFolderStringextraFoldersIEnumerable<String>diagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport CreateFolder(
string storePath,
string outPath,
string folderPath,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringdiagDiagnosticsContextoverwriteBoolean
Returns
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 FileOpResultC#
public static FileOpResult CreateStore(string path, string storeName = null, bool overwrite = false);Parameters
pathStringstoreNameStringoverwriteBoolean
Returns
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 ImportReportC#
public static ImportReport CreateStoreWith(
string path,
IEnumerable<ImportedMessage> items,
string folderPath = "Authored",
string storeName = null,
bool overwrite = false,
DiagnosticsContext diag = null
);Parameters
pathStringitemsIEnumerable<ImportedMessage>folderPathStringstoreNameStringoverwriteBooleandiagDiagnosticsContext
Returns
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 ImportReportC#
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
pathStringitemsIEnumerable<ImportedMessage>defaultFolderStringextraFoldersIEnumerable<String>storeNameStringoverwriteBooleandiagDiagnosticsContext
Returns
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 EditReportC#
public static EditReport DeleteFolder(
string storePath,
string outPath,
string folderPath,
bool recursive = false,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringrecursiveBooleandiagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
public static EditReport DeleteItems(
string storePath,
string outPath,
string folderPath,
Func<PstMessage, bool> match,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringmatchFunc<PstMessage, Boolean>diagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
public static EditReport EditItems(
string storePath,
string outPath,
string folderPath,
Func<PstMessage, bool> match,
ItemEdit edit,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringmatchFunc<PstMessage, Boolean>editItemEditdiagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
public static EditReport MoveFolder(
string storePath,
string outPath,
string folderPath,
string newParentPath,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringnewParentPathStringdiagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
public static EditReport MoveItems(
string storePath,
string outPath,
string fromFolder,
Func<PstMessage, bool> match,
string toFolder,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfromFolderStringmatchFunc<PstMessage, Boolean>toFolderStringdiagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
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
storePathStringoutPathStringfolderPathStringmsgMatchFunc<PstMessage, Boolean>attMatchFunc<Attachment, Boolean>diagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
public static EditReport RenameFolder(
string storePath,
string outPath,
string folderPath,
string newName,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringnewNameStringdiagDiagnosticsContextoverwriteBoolean
Returns
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 EditReportC#
public static EditReport SetFolderClass(
string storePath,
string outPath,
string folderPath,
string containerClass,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
storePathStringoutPathStringfolderPathStringcontainerClassString- One of the
FolderClassconstants, e.g.FolderClass.Appointment. Any string is accepted; unrecognised values are simply ignored by clients. diagDiagnosticsContextoverwriteBoolean
Returns
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
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 AuthoringSessionC#
public sealed class AuthoringSessionConstructors
| Name | Description |
|---|---|
AuthoringSession(String, DiagnosticsContext) | Start a session over the store at storePath. |
Properties
| Name | Description |
|---|---|
Count | Number of edits queued so far. |
Methods
| Name | Description |
|---|---|
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
storePathStringdiagDiagnosticsContext
Count property
Number of edits queued so far.
VB.NET
Public ReadOnly Property Count As IntegerC#
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 EditReportC#
public EditReport Commit(string outPath, bool overwrite = true);Parameters
outPathStringoverwriteBoolean
Returns
DeleteFolder(String, Boolean) method
VB.NET
Public Function DeleteFolder(folderPath As String, Optional recursive As Boolean = False) As AuthoringSessionC#
public AuthoringSession DeleteFolder(string folderPath, bool recursive = false);Parameters
folderPathStringrecursiveBoolean
Returns
DeleteItems(String, Func<PstMessage, Boolean>) method
VB.NET
Public Function DeleteItems(folderPath As String, match As Func(Of PstMessage, Boolean)) As AuthoringSessionC#
public AuthoringSession DeleteItems(string folderPath, Func<PstMessage, bool> match);Parameters
folderPathStringmatchFunc<PstMessage, Boolean>
Returns
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 AuthoringSessionC#
public AuthoringSession EditItems(string folderPath, Func<PstMessage, bool> match, ItemEdit edit);Parameters
folderPathStringmatchFunc<PstMessage, Boolean>editItemEdit
Returns
MoveFolder(String, String) method
VB.NET
Public Function MoveFolder(folderPath As String, newParentPath As String) As AuthoringSessionC#
public AuthoringSession MoveFolder(string folderPath, string newParentPath);Parameters
folderPathStringnewParentPathString
Returns
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 AuthoringSessionC#
public AuthoringSession MoveItems(string fromFolder, Func<PstMessage, bool> match, string toFolder);Parameters
fromFolderStringmatchFunc<PstMessage, Boolean>toFolderString
Returns
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 AuthoringSessionC#
public AuthoringSession RemoveAttachments(
string folderPath,
Func<PstMessage, bool> msgMatch,
Func<Attachment, bool> attMatch
);Parameters
folderPathStringmsgMatchFunc<PstMessage, Boolean>attMatchFunc<Attachment, Boolean>
Returns
RenameFolder(String, String) method
VB.NET
Public Function RenameFolder(folderPath As String, newName As String) As AuthoringSessionC#
public AuthoringSession RenameFolder(string folderPath, string newName);Parameters
folderPathStringnewNameString
Returns
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 AuthoringSessionC#
public AuthoringSession SetFolderClass(string folderPath, string containerClass);Parameters
folderPathStringcontainerClassString- One of the
FolderClassconstants, e.g.FolderClass.Appointment.
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
ContactBuilder class
VB.NET
Public NotInheritable Class ContactBuilder
Inherits ItemBuilderBaseC#
public sealed class ContactBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 ContactBuilderC#
public ContactBuilder Address(string business, string home = "");Parameters
businessStringhomeString
Returns
Anniversary(DateTime) method
The contact's wedding anniversary: a calendar day, as Birthday.
VB.NET
Public Function Anniversary(d As Date) As ContactBuilderC#
public ContactBuilder Anniversary(DateTime d);Parameters
dDateTime
Returns
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 ContactBuilderC#
public ContactBuilder Birthday(DateTime d);Parameters
dDateTime
Returns
Company(String) method
VB.NET
Public Function Company(s As String) As ContactBuilderC#
public ContactBuilder Company(string s);Parameters
sString
Returns
Department(String) method
VB.NET
Public Function Department(s As String) As ContactBuilderC#
public ContactBuilder Department(string s);Parameters
sString
Returns
DisplayName(String) method
VB.NET
Public Function DisplayName(s As String) As ContactBuilderC#
public ContactBuilder DisplayName(string s);Parameters
sString
Returns
Email(String, Int32) method
VB.NET
Public Function Email(address As String, Optional slot As Integer = 1) As ContactBuilderC#
public ContactBuilder Email(string address, int slot = 1);Parameters
addressStringslotInt32
Returns
Fax(String) method
VB.NET
Public Function Fax(business As String) As ContactBuilderC#
public ContactBuilder Fax(string business);Parameters
businessString
Returns
JobTitle(String) method
VB.NET
Public Function JobTitle(s As String) As ContactBuilderC#
public ContactBuilder JobTitle(string s);Parameters
sString
Returns
Name(String, String, String) method
VB.NET
Public Function Name(given As String, surname As String, Optional middle As String = "") As ContactBuilderC#
public ContactBuilder Name(string given, string surname, string middle = "");Parameters
givenStringsurnameStringmiddleString
Returns
Notes(String) method
Free-text notes — stored as the contact item's body.
VB.NET
Public Function Notes(s As String) As ContactBuilderC#
public ContactBuilder Notes(string s);Parameters
sString
Returns
Phone(String, String, String) method
VB.NET
Public Function Phone(
business As String,
Optional home As String = "",
Optional mobile As String = ""
) As ContactBuilderC#
public ContactBuilder Phone(string business, string home = "", string mobile = "");Parameters
businessStringhomeStringmobileString
Returns
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 ContactBuilderC#
public ContactBuilder Photo(byte[] jpeg, string fileName = "ContactPicture.jpg");Parameters
jpegByte[]fileNameString
Returns
WebPage(String) method
VB.NET
Public Function WebPage(s As String) As ContactBuilderC#
public ContactBuilder WebPage(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
DistListBuilder class
VB.NET
Public NotInheritable Class DistListBuilder
Inherits ItemBuilderBaseC#
public sealed class DistListBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 DistListBuilderC#
public DistListBuilder AddMember(string displayName, string email);Parameters
displayNameStringemailString
Returns
Name(String) method
The list's display name.
VB.NET
Public Function Name(s As String) As DistListBuilderC#
public DistListBuilder Name(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
ItemBuilder class
Entry point for building typed items: ItemBuilder.Mail(), .Appointment(), .Contact(), .Task(), .Note().
VB.NET
Public NotInheritable Class ItemBuilderC#
public sealed class ItemBuilderMethods
| Name | Description |
|---|---|
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 AppointmentBuilderC#
public static AppointmentBuilder Appointment();Returns
Contact() method static
VB.NET
Public Shared Function Contact() As ContactBuilderC#
public static ContactBuilder Contact();Returns
DistributionList() method static
VB.NET
Public Shared Function DistributionList() As DistListBuilderC#
public static DistListBuilder DistributionList();Returns
Journal() method static
VB.NET
Public Shared Function Journal() As JournalBuilderC#
public static JournalBuilder Journal();Returns
Mail() method static
VB.NET
Public Shared Function Mail() As MailBuilderC#
public static MailBuilder Mail();Returns
Note() method static
VB.NET
Public Shared Function Note() As NoteBuilderC#
public static NoteBuilder Note();Returns
Rss() method static
VB.NET
Public Shared Function Rss() As RssBuilderC#
public static RssBuilder Rss();Returns
Task() method static
VB.NET
Public Shared Function Task() As TaskBuilderC#
public static TaskBuilder Task();Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
ItemBuilderBase class
Shared surface: subject/body/attachments and the terminal Build.
VB.NET
Public MustInherit Class ItemBuilderBaseC#
public abstract class ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 ImportedMessageC#
public ImportedMessage Build();Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
JournalBuilder class
VB.NET
Public NotInheritable Class JournalBuilder
Inherits ItemBuilderBaseC#
public sealed class JournalBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 JournalBuilderC#
public JournalBuilder BodyText(string s);Parameters
sString
Returns
DurationMinutes(Int32) method
VB.NET
Public Function DurationMinutes(minutes As Integer) As JournalBuilderC#
public JournalBuilder DurationMinutes(int minutes);Parameters
minutesInt32
Returns
EndsAt(DateTime) method
VB.NET
Public Function EndsAt(d As Date) As JournalBuilderC#
public JournalBuilder EndsAt(DateTime d);Parameters
dDateTime
Returns
JournalType(String) method
Free-text activity type, e.g. "Phone call".
VB.NET
Public Function JournalType(s As String) As JournalBuilderC#
public JournalBuilder JournalType(string s);Parameters
sString
Returns
StartsAt(DateTime) method
VB.NET
Public Function StartsAt(d As Date) As JournalBuilderC#
public JournalBuilder StartsAt(DateTime d);Parameters
dDateTime
Returns
Subject(String) method
VB.NET
Public Function Subject(s As String) As JournalBuilderC#
public JournalBuilder Subject(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
MailBuilder class
VB.NET
Public NotInheritable Class MailBuilder
Inherits ItemBuilderBaseC#
public sealed class MailBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 MailBuilderC#
public MailBuilder AddAttachment(
string fileName,
byte[] data,
string mimeType = "application/octet-stream"
);Parameters
fileNameStringdataByte[]mimeTypeString
Returns
AddEmbeddedMessage(String, ImportedMessage) method
VB.NET
Public Function AddEmbeddedMessage(fileName As String, embedded As ImportedMessage) As MailBuilderC#
public MailBuilder AddEmbeddedMessage(string fileName, ImportedMessage embedded);Parameters
fileNameStringembeddedImportedMessage
Returns
Bcc(String, String) method
VB.NET
Public Function Bcc(name As String, email As String) As MailBuilderC#
public MailBuilder Bcc(string name, string email);Parameters
nameStringemailString
Returns
BodyHtml(String) method
VB.NET
Public Function BodyHtml(s As String) As MailBuilderC#
public MailBuilder BodyHtml(string s);Parameters
sString
Returns
BodyText(String) method
VB.NET
Public Function BodyText(s As String) As MailBuilderC#
public MailBuilder BodyText(string s);Parameters
sString
Returns
Cc(String, String) method
VB.NET
Public Function Cc(name As String, email As String) As MailBuilderC#
public MailBuilder Cc(string name, string email);Parameters
nameStringemailString
Returns
From(String, String) method
VB.NET
Public Function From(name As String, email As String) As MailBuilderC#
public MailBuilder From(string name, string email);Parameters
nameStringemailString
Returns
Importance(Int32) method
0 low, 1 normal, 2 high.
VB.NET
Public Function Importance(level As Integer) As MailBuilderC#
public MailBuilder Importance(int level);Parameters
levelInt32
Returns
MessageId(String) method
VB.NET
Public Function MessageId(id As String) As MailBuilderC#
public MailBuilder MessageId(string id);Parameters
idString
Returns
Read(Boolean) method
Mark the item read (default) or unread.
VB.NET
Public Function Read(Optional value As Boolean = True) As MailBuilderC#
public MailBuilder Read(bool value = true);Parameters
valueBoolean
Returns
SentOn(DateTime) method
VB.NET
Public Function SentOn(d As Date) As MailBuilderC#
public MailBuilder SentOn(DateTime d);Parameters
dDateTime
Returns
Subject(String) method
VB.NET
Public Function Subject(s As String) As MailBuilderC#
public MailBuilder Subject(string s);Parameters
sString
Returns
To(String, String) method
VB.NET
Public Function To(name As String, email As String) As MailBuilderC#
public MailBuilder To(string name, string email);Parameters
nameStringemailString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
NoteBuilder class
VB.NET
Public NotInheritable Class NoteBuilder
Inherits ItemBuilderBaseC#
public sealed class NoteBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 NoteBuilderC#
public NoteBuilder Color(int c);Parameters
cInt32
Returns
Size(Int32, Int32) method
VB.NET
Public Function Size(width As Integer, height As Integer) As NoteBuilderC#
public NoteBuilder Size(int width, int height);Parameters
widthInt32heightInt32
Returns
Subject(String) method
VB.NET
Public Function Subject(s As String) As NoteBuilderC#
public NoteBuilder Subject(string s);Parameters
sString
Returns
Text(String) method
VB.NET
Public Function Text(s As String) As NoteBuilderC#
public NoteBuilder Text(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
RssBuilder class
An RSS feed item (IPM.Post.Rss).
VB.NET
Public NotInheritable Class RssBuilder
Inherits ItemBuilderBaseC#
public sealed class RssBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 RssBuilderC#
public RssBuilder Article(string url, string guid = "");Parameters
urlStringguidString
Returns
BodyHtml(String) method
VB.NET
Public Function BodyHtml(s As String) As RssBuilderC#
public RssBuilder BodyHtml(string s);Parameters
sString
Returns
BodyText(String) method
VB.NET
Public Function BodyText(s As String) As RssBuilderC#
public RssBuilder BodyText(string s);Parameters
sString
Returns
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 RssBuilderC#
public RssBuilder Channel(string name, string url);Parameters
nameStringurlString
Returns
PostedOn(DateTime) method
VB.NET
Public Function PostedOn(d As Date) As RssBuilderC#
public RssBuilder PostedOn(DateTime d);Parameters
dDateTime
Returns
Read(Boolean) method
VB.NET
Public Function Read(Optional value As Boolean = True) As RssBuilderC#
public RssBuilder Read(bool value = true);Parameters
valueBoolean
Returns
Subject(String) method
VB.NET
Public Function Subject(s As String) As RssBuilderC#
public RssBuilder Subject(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Authoring namespace
TaskBuilder class
VB.NET
Public NotInheritable Class TaskBuilder
Inherits ItemBuilderBaseC#
public sealed class TaskBuilder : ItemBuilderBaseMethods
| Name | Description |
|---|---|
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 TaskBuilderC#
public TaskBuilder BodyText(string s);Parameters
sString
Returns
CompletedOn(DateTime) method
Mark the task complete, on this day (a calendar day, as StartDate).
VB.NET
Public Function CompletedOn(d As Date) As TaskBuilderC#
public TaskBuilder CompletedOn(DateTime d);Parameters
dDateTime
Returns
DueDate(DateTime) method
The day the task is due. A calendar day, as StartDate.
VB.NET
Public Function DueDate(d As Date) As TaskBuilderC#
public TaskBuilder DueDate(DateTime d);Parameters
dDateTime
Returns
Owner(String) method
VB.NET
Public Function Owner(s As String) As TaskBuilderC#
public TaskBuilder Owner(string s);Parameters
sString
Returns
PercentComplete(Double) method
0..1.
VB.NET
Public Function PercentComplete(fraction As Double) As TaskBuilderC#
public TaskBuilder PercentComplete(double fraction);Parameters
fractionDouble
Returns
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 TaskBuilderC#
public TaskBuilder StartDate(DateTime d);Parameters
dDateTime
Returns
Status(Int32) method
0 not started, 1 in progress, 2 complete, 3 waiting, 4 deferred.
VB.NET
Public Function Status(value As Integer) As TaskBuilderC#
public TaskBuilder Status(int value);Parameters
valueInt32
Returns
Subject(String) method
VB.NET
Public Function Subject(s As String) As TaskBuilderC#
public TaskBuilder Subject(string s);Parameters
sString
Returns
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Convert namespace
Classes
| Name | Description |
|---|---|
Dedup | 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. |
DestinationExistsException | 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. |
EditReport | Result of a store edit: the standard error contract plus how many items/folders changed. |
ItemEdit | Property changes to apply to matching items (any field left Nothing is unchanged). |
MergePreflight | Scans merge sources for corruption before the merge begins, and repairs the ones the caller agrees to repair. See Scan. |
MergeReport | Outcome of a merge. ErrorCode 0 = success; on failure ErrorDescription says why (ToString() renders "code: description"). |
MergeVerification | The outcome of checking a merge's output against its sources. |
OrphanScanResult | What StoreMerger.OrphanScan found. ErrorCode 0 = every table was read. |
PasswordChangeReport | 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. |
PasswordStatus | Result of StorePassword.GetStatus: whether the file has an open password and the stored CRC value. |
PreflightReport | Outcome of a pre-merge scan (and repair, when one was run). |
SourceHealth | One source file's pre-merge verdict. |
SplitPart | |
SplitReport | 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. |
StoreConverter | |
StoreMerger | |
StorePassword | 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. |
StoreSplitter | |
SweepPlanResult | What StoreMerger.SweepPlan found a sweep would change. ErrorCode 0 = every folder table was read. |
VolumeInfo | One output volume produced by a capped merge. |
VolumeReport | Outcome of a capped (volume-split) merge. ErrorCode 0 = success. |
Enumerations
| Name | Description |
|---|---|
MergeLayout | How a merge lays out the sources in the output store. |
RepairChoice | 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. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
Dedup class
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 DedupC#
public sealed class DedupConstructors
| Name | Description |
|---|---|
Dedup() |
Properties
| Name | Description |
|---|---|
AcrossFolders | 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. |
BaseDrops | 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. |
BaseDuplicateCount | Total 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 BooleanC#
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 IntegerC#
public int BaseDuplicateCount { get; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
DestinationExistsException class
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 IOExceptionC#
public class DestinationExistsException : IOExceptionConstructors
| Name | Description |
|---|---|
DestinationExistsException(String) |
Properties
| Name | Description |
|---|---|
DestinationPath | The destination path that already exists. |
Details
DestinationExistsException(String) constructor
VB.NET
Public Sub New(path As String)C#
public DestinationExistsException(string path);Parameters
pathString
DestinationPath property
The destination path that already exists.
VB.NET
Public ReadOnly Property DestinationPath As StringC#
public string DestinationPath { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
EditReport class
Result of a store edit: the standard error contract plus how many items/folders changed.
VB.NET
Public NotInheritable Class EditReport
Inherits OperationResultC#
public sealed class EditReport : OperationResultConstructors
| Name | Description |
|---|---|
EditReport() |
Properties
| Name | Description |
|---|---|
AttachmentsRemoved | |
FoldersDeleted | |
FoldersMoved | |
FoldersReclassified | |
FoldersRenamed | |
ItemsDeleted | |
ItemsEdited | |
ItemsMoved | |
ItemsNotFound | 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. |
ItemsRequested | 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. |
Details
EditReport() constructor
VB.NET
Public Sub New()C#
public EditReport();AttachmentsRemoved property
VB.NET
Public Property AttachmentsRemoved As IntegerC#
public int AttachmentsRemoved { get; set; }Property value
Int32
FoldersDeleted property
VB.NET
Public Property FoldersDeleted As IntegerC#
public int FoldersDeleted { get; set; }Property value
Int32
FoldersMoved property
VB.NET
Public Property FoldersMoved As IntegerC#
public int FoldersMoved { get; set; }Property value
Int32
FoldersReclassified property
VB.NET
Public Property FoldersReclassified As IntegerC#
public int FoldersReclassified { get; set; }Property value
Int32
FoldersRenamed property
VB.NET
Public Property FoldersRenamed As IntegerC#
public int FoldersRenamed { get; set; }Property value
Int32
ItemsDeleted property
VB.NET
Public Property ItemsDeleted As IntegerC#
public int ItemsDeleted { get; set; }Property value
Int32
ItemsEdited property
VB.NET
Public Property ItemsEdited As IntegerC#
public int ItemsEdited { get; set; }Property value
Int32
ItemsMoved property
VB.NET
Public Property ItemsMoved As IntegerC#
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 IntegerC#
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 IntegerC#
public int ItemsRequested { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
ItemEdit class
Property changes to apply to matching items (any field left Nothing is unchanged).
VB.NET
Public NotInheritable Class ItemEditC#
public sealed class ItemEditConstructors
| Name | Description |
|---|---|
ItemEdit() |
Properties
| Name | Description |
|---|---|
BodyText | New plain-text body, or Nothing to leave unchanged. |
Importance | New importance (0 low, 1 normal, 2 high), or Nothing to leave unchanged. |
Subject | New 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 StringC#
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 StringC#
public string Subject { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
MergeLayout enumeration
How a merge lays out the sources in the output store.
VB.NET
Public Enum MergeLayoutC#
public enum MergeLayoutMembers
| Name | Value | Description |
|---|---|---|
Stacked | 0 | Each source becomes its own top-level folder tree under the destination root (the original behaviour) — every source keeps a separate Inbox/Calendar/etc. |
Unified | 1 | Folders 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
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 MergePreflightC#
public sealed class MergePreflightMethods
| Name | Description |
|---|---|
Repair(PreflightReport, String, Func<SourceHealth, Int32, Int32, RepairChoice>, DiagnosticsContext) static | Repair the corrupt sources in NEVER throws, and never returns Nothing. The result is |
Scan(IList<String>, DiagnosticsContext) 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. |
ScanAndRepairAll(IList<String>, String, DiagnosticsContext) 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. |
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 PreflightReportC#
public static PreflightReport Repair(
PreflightReport scan,
string workDir,
Func<SourceHealth, int, int, RepairChoice> prompt = null,
DiagnosticsContext diag = null
);Parameters
scanPreflightReportworkDirString- Where repaired copies are written. Created if missing. Nothing or empty:
Settings.TempFolder. promptFunc<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".
diagDiagnosticsContext
Returns
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 PreflightReportC#
public static PreflightReport Scan(IList<string> sourcePaths, DiagnosticsContext diag = null);Parameters
sourcePathsIList<String>diagDiagnosticsContext
Returns
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 PreflightReportC#
public static PreflightReport ScanAndRepairAll(
IList<string> sourcePaths,
string workDir,
DiagnosticsContext diag = null
);Parameters
sourcePathsIList<String>workDirStringdiagDiagnosticsContext
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
MergeReport class
Outcome of a merge. ErrorCode 0 = success; on failure ErrorDescription says why (ToString() renders "code: description").
VB.NET
Public NotInheritable Class MergeReport
Inherits OperationResultC#
public sealed class MergeReport : OperationResultConstructors
| Name | Description |
|---|---|
MergeReport() |
Properties
| Name | Description |
|---|---|
BlankMessagesRemoved | Blank mail removed (no subject, no body, no attachments) — dropBlankMessages. |
DuplicatesRemoved | |
FilteredOut | Messages dropped by the item-type filter (selective merge). |
FoldersMerged | |
FoldersPruned | Empty folders removed by the prune pass (pruneEmpty). |
FoldersReclassified | 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. |
FoldersRehomed | 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. |
MessagesMerged | How many messages (items of every kind) the merged output holds. |
MessagesRehomed | Messages owned by the store root folder itself (invisible to Outlook) and re-homed into the IPM root's contents table. |
SourcesSkipped | 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. |
TotalNodes | |
Verification | 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. |
Warning | Non-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 IntegerC#
public int BlankMessagesRemoved { get; set; }Property value
Int32
DuplicatesRemoved property
VB.NET
Public Property DuplicatesRemoved As IntegerC#
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 IntegerC#
public int FilteredOut { get; set; }Property value
Int32
FoldersMerged property
VB.NET
Public Property FoldersMerged As IntegerC#
public int FoldersMerged { get; set; }Property value
Int32
FoldersPruned property
Empty folders removed by the prune pass (pruneEmpty).
VB.NET
Public Property FoldersPruned As IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
public int SourcesSkipped { get; set; }Property value
Int32
TotalNodes property
VB.NET
Public Property TotalNodes As IntegerC#
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 MergeVerificationC#
public MergeVerification Verification { get; set; }Property value
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 StringC#
public string Warning { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
MergeVerification class
The outcome of checking a merge's output against its sources.
VB.NET
Public NotInheritable Class MergeVerificationC#
public sealed class MergeVerificationConstructors
| Name | Description |
|---|---|
MergeVerification() |
Properties
| Name | Description |
|---|---|
DifferenceCount | How many differences were found, including any beyond those listed. |
Differences | Each difference in plain language, by source file and folder. At most the first 200. |
ExpectedMessages | Messages the output should hold: the sources' messages less those removed on purpose. |
MessagesInRenamedFolders | 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. |
MissingMessages | Source messages with no counterpart in the output that the merge did not account for. |
OutputMessages | Messages found in the output. |
Passed | True when the output holds what the sources held, less what the merge was asked to remove. |
SourceMessages | Messages found in the sources. |
UnexpectedMessages | Output messages with no counterpart in any source. |
UnopenableMessages | Messages the output lists but that could not be opened. |
Methods
| Name | Description |
|---|---|
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 IntegerC#
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 LongC#
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 LongC#
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 LongC#
public long MissingMessages { get; set; }Property value
Int64
OutputMessages property
Messages found in the output.
VB.NET
Public Property OutputMessages As LongC#
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 BooleanC#
public bool Passed { get; }Property value
Boolean
SourceMessages property
Messages found in the sources.
VB.NET
Public Property SourceMessages As LongC#
public long SourceMessages { get; set; }Property value
Int64
UnexpectedMessages property
Output messages with no counterpart in any source.
VB.NET
Public Property UnexpectedMessages As LongC#
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 LongC#
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
OrphanScanResult class
What StoreMerger.OrphanScan found. ErrorCode 0 = every table was read.
VB.NET
Public NotInheritable Class OrphanScanResult
Inherits OperationResultC#
public sealed class OrphanScanResult : OperationResultConstructors
| Name | Description |
|---|---|
OrphanScanResult() |
Properties
| Name | Description |
|---|---|
MsgNodes | Message nodes in the store. |
Orphans | 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. |
Referenced | Distinct messages some folder table lists. |
TablesUnreadable | Tables 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 IntegerC#
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 IntegerC#
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 IntegerC#
public int TablesUnreadable { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
PasswordChangeReport class
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 OperationResultC#
public sealed class PasswordChangeReport : OperationResultConstructors
| Name | Description |
|---|---|
PasswordChangeReport() |
Properties
| Name | Description |
|---|---|
HadPassword | Whether the source had a password before the change. |
HasPassword | Whether the output has a password now (read back from the output file). |
NodesWritten | |
OutputIsValid | True when the output passes strict structural validation. |
OutputPath | |
OutputReport | Strict structural validation of the output. |
PasswordCrc | The CRC value written (0 = removed). |
SourcePath | |
Succeeded | 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. |
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 BooleanC#
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 BooleanC#
public bool HasPassword { get; set; }Property value
Boolean
NodesWritten property
VB.NET
Public Property NodesWritten As IntegerC#
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 BooleanC#
public bool OutputIsValid { get; }Property value
Boolean
OutputPath property
VB.NET
Public Property OutputPath As StringC#
public string OutputPath { get; set; }Property value
String
OutputReport property
Strict structural validation of the output.
VB.NET
Public Property OutputReport As ValidationReportC#
public ValidationReport OutputReport { get; set; }Property value
PasswordCrc property
The CRC value written (0 = removed).
VB.NET
Public Property PasswordCrc As UIntegerC#
public uint PasswordCrc { get; set; }Property value
UInt32
SourcePath property
VB.NET
Public Property SourcePath As StringC#
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 BooleanC#
public override bool Succeeded { get; }Property value
Boolean
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
PasswordStatus class
Result of StorePassword.GetStatus: whether the file has an open password and the stored CRC value.
VB.NET
Public NotInheritable Class PasswordStatus
Inherits OperationResultC#
public sealed class PasswordStatus : OperationResultConstructors
| Name | Description |
|---|---|
PasswordStatus() |
Properties
| Name | Description |
|---|---|
HasPassword | True when PidTagPstPassword is present and non-zero. |
PasswordCrc | The 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 BooleanC#
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 UIntegerC#
public uint PasswordCrc { get; set; }Property value
UInt32
Path property
VB.NET
Public Property Path As StringC#
public string Path { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
PreflightReport class
Outcome of a pre-merge scan (and repair, when one was run).
VB.NET
Public NotInheritable Class PreflightReport
Inherits OperationResultC#
public sealed class PreflightReport : OperationResultConstructors
| Name | Description |
|---|---|
PreflightReport() |
Properties
| Name | Description |
|---|---|
Cancelled | True when the caller answered RepairChoice.Cancel. The merge must not proceed. |
CorruptCount | 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)?" |
EffectiveSources | 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). |
Files | Every source, in the order supplied. |
LargePageOstCount | 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. |
LegacyAnsiCount | 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. |
NotExaminedCount | 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. |
RepairedCount | How many sources were successfully repaired. |
RepairFailedCount | How 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 |
Methods
| Name | Description |
|---|---|
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 BooleanC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
public int NotExaminedCount { get; }Property value
Int32
RepairedCount property
How many sources were successfully repaired.
VB.NET
Public ReadOnly Property RepairedCount As IntegerC#
public int RepairedCount { get; }Property value
Int32
RepairFailedCount property
How many repairs were attempted and failed.
VB.NET
Public ReadOnly Property RepairFailedCount As IntegerC#
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 IntegerC#
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 StringC#
public string Describe();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
RepairChoice enumeration
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 RepairChoiceC#
public enum RepairChoiceMembers
| Name | Value | Description |
|---|---|---|
Yes | 0 | Repair this file; ask again for the next one. |
YesToAll | 1 | Repair this file and every remaining corrupt file without asking again. |
No | 2 | Leave this file as it is; ask again for the next one. |
NoToAll | 3 | Leave every remaining corrupt file as it is, without asking again. |
Cancel | 4 | Abandon the whole operation — nothing further is scanned, repaired or merged. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
SourceHealth class
One source file's pre-merge verdict.
VB.NET
Public NotInheritable Class SourceHealthC#
public sealed class SourceHealthProperties
| Name | Description |
|---|---|
EffectivePath | The path a merge should actually consume: the repaired copy when there is one, otherwise the original. |
ErrorCount | Structural errors the validator found. |
IsCorrupted | True 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 ( 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 ( 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 |
MessagesIncomplete | Messages the repair recovered without part of their content (usually the body). |
MessagesLost | Messages 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. 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. |
NotExaminedCode | Why the file could not be examined (ErrorCode.FileNotFound, ErrorCode.FileLocked, ErrorCode.AccessDenied, …); ErrorCode.Ok when it was examined. |
Path | The source file as supplied. |
RepairAttempted | True once a repair was attempted for this file. |
RepairedPath | The repaired copy, when one was written. The original is never modified. |
RepairErrorCode | 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. |
RepairSucceeded | True when the repair produced a usable file. |
Summary | One line fit to show a user. |
SupportReportPath | Where 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 StringC#
public string EffectivePath { get; }Property value
String
ErrorCount property
Structural errors the validator found.
VB.NET
Public Property ErrorCount As IntegerC#
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 BooleanC#
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 BooleanC#
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 BooleanC#
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 BooleanC#
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 IntegerC#
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 IntegerC#
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 BooleanC#
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.
Property value
Path property
The source file as supplied.
VB.NET
Public ReadOnly Property Path As StringC#
public string Path { get; }Property value
String
RepairAttempted property
True once a repair was attempted for this file.
VB.NET
Public Property RepairAttempted As BooleanC#
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 StringC#
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.
Property value
RepairSucceeded property
True when the repair produced a usable file.
VB.NET
Public Property RepairSucceeded As BooleanC#
public bool RepairSucceeded { get; set; }Property value
Boolean
Summary property
One line fit to show a user.
VB.NET
Public Property Summary As StringC#
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 StringC#
public string SupportReportPath { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
SplitPart class
VB.NET
Public NotInheritable Class SplitPartC#
public sealed class SplitPartConstructors
| Name | Description |
|---|---|
SplitPart() |
Properties
| Name | Description |
|---|---|
MessageCount | 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. |
MessagesLost | 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. |
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 IntegerC#
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 IntegerC#
public int MessagesLost { get; set; }Property value
Int32
Path property
VB.NET
Public Property Path As StringC#
public string Path { get; set; }Property value
String
SizeBytes property
VB.NET
Public Property SizeBytes As LongC#
public long SizeBytes { get; set; }Property value
Int64
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
SplitReport class
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 OperationResultC#
public sealed class SplitReport : OperationResultConstructors
| Name | Description |
|---|---|
SplitReport() |
Properties
| Name | Description |
|---|---|
Parts | |
TotalMessages |
Details
SplitReport() constructor
VB.NET
Public Sub New()C#
public SplitReport();Parts property
Property value
List<SplitPart>
TotalMessages property
VB.NET
Public Property TotalMessages As IntegerC#
public int TotalMessages { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
StoreConverter class
VB.NET
Public NotInheritable Class StoreConverterC#
public sealed class StoreConverterMethods
| Name | Description |
|---|---|
ConvertToUnicode(String, String) 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). |
ConvertToUnicode(String, String, DiagnosticsContext, Boolean) 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). |
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 GenericResultC#
public static GenericResult ConvertToUnicode(string sourcePath, string outPath);Parameters
sourcePathStringoutPathString
Returns
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 GenericResultC#
public static GenericResult ConvertToUnicode(
string sourcePath,
string outPath,
DiagnosticsContext diag,
bool overwrite = false
);Parameters
sourcePathStringoutPathStringdiagDiagnosticsContextoverwriteBoolean
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
StoreMerger class
VB.NET
Public NotInheritable Class StoreMergerC#
public sealed class StoreMergerProperties
| Name | Description |
|---|---|
DropSearchFolders static | When True (default) merges drop search/view folders (non-IPM root children). Set False (CLI --keep-search) to carry them verbatim. |
MaxNodeIdsPerVolume 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. |
MergeWorkers static | Max concurrent source-conversion workers for the parallel merge. |
ParallelMerge 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). |
Methods
| Name | Description |
|---|---|
Merge(IList<String>, String, Dedup, HashSet<ItemKind>, DiagnosticsContext, Boolean, Func<Int32, Dictionary<UInt32, HashSet<UInt32>>>, Int64, MergeLayout, String, Boolean, Boolean, Boolean) static | Merge Content that cannot be read fails the merge and nothing is written, unless |
MergeToVolumes(IList<String>, String, Int64, Dedup, HashSet<ItemKind>, DiagnosticsContext, Boolean, String, Boolean, Boolean, MergeLayout, Boolean) 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). |
OrphanScan(String) 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. |
SweepPlan(String) 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. |
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 BooleanC#
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 ULongC#
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 IntegerC#
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 BooleanC#
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 MergeReportC#
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
sourcePathsIList<String>outPathStringdedupDedupkeepKindsHashSet<ItemKind>diagDiagnosticsContextoverwriteBooleanextraDropsFunc<Int32, Dictionary<UInt32, HashSet<UInt32>>>maxBytesInt64layoutMergeLayoutrootNameStringpruneEmptyBooleandropBlankMessagesBooleanverifyBoolean- 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 isErrorCode.VerificationFailedand the output is still there to inspect. It costs one extra read of every source and one of the output.
Returns
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 VolumeReportC#
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
sourcePathsIList<String>outBasePathStringcapBytesInt64dedupDedupkeepKindsHashSet<ItemKind>diagDiagnosticsContextoverwriteBooleanrootNameStringdropBlankMessagesBooleanpruneEmptyBooleanlayoutMergeLayout- 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.
verifyBoolean- 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 isErrorCode.VerificationFailedand the volumes are still there to inspect. It costs one extra read of every source and one of every volume.
Returns
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 OrphanScanResultC#
public static OrphanScanResult OrphanScan(string path);Parameters
pathString
Returns
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 SweepPlanResultC#
public static SweepPlanResult SweepPlan(string path);Parameters
pathString
Returns
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
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 StorePasswordC#
public sealed class StorePasswordMethods
| Name | Description |
|---|---|
ComputeCrc(String) 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. |
GetStatus(String) static | Report whether path has an open password set (PidTagPstPassword present and non-zero), without throwing. |
RemovePassword(String, String, DiagnosticsContext, Boolean) 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. |
SetPassword(String, String, String, DiagnosticsContext, Boolean) 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. |
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 UIntegerC#
public static uint ComputeCrc(string password);Parameters
passwordString
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 PasswordStatusC#
public static PasswordStatus GetStatus(string path);Parameters
pathString
Returns
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 PasswordChangeReportC#
public static PasswordChangeReport RemovePassword(
string srcPath,
string outPath,
DiagnosticsContext diag = null,
bool overwrite = false
);Parameters
srcPathStringoutPathStringdiagDiagnosticsContextoverwriteBoolean
Returns
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 PasswordChangeReportC#
public static PasswordChangeReport SetPassword(
string srcPath,
string outPath,
string password,
DiagnosticsContext diag = null,
bool overwrite = false
);Parameters
srcPathStringoutPathStringpasswordStringdiagDiagnosticsContextoverwriteBoolean
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
StoreSplitter class
VB.NET
Public NotInheritable Class StoreSplitterC#
public sealed class StoreSplitterMethods
| Name | Description |
|---|---|
SplitByPredicate(String, String, String, Func<PstMessage, Boolean>, DiagnosticsContext, Boolean) 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. |
SplitBySize(String, String, Int64, DiagnosticsContext, Boolean) 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). |
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 SplitReportC#
public static SplitReport SplitByPredicate(
string sourcePath,
string matchPath,
string restPath,
Func<PstMessage, bool> predicate,
DiagnosticsContext diag = null,
bool overwrite = false
);Parameters
sourcePathStringmatchPathStringrestPathStringpredicateFunc<PstMessage, Boolean>diagDiagnosticsContextoverwriteBoolean- False (the default): if either file already exists the split is refused with
ErrorCode.DestinationExistsbefore anything is read or written.
Returns
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 SplitReportC#
public static SplitReport SplitBySize(
string sourcePath,
string outDir,
long maxBytes,
DiagnosticsContext diag = null,
bool overwrite = false
);Parameters
sourcePathStringoutDirStringmaxBytesInt64diagDiagnosticsContextoverwriteBoolean- False (the default): if any part's file already exists the split is refused with
ErrorCode.DestinationExistsbefore anything is written.
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
SweepPlanResult class
What StoreMerger.SweepPlan found a sweep would change. ErrorCode 0 = every folder table was read.
VB.NET
Public NotInheritable Class SweepPlanResult
Inherits OperationResultC#
public sealed class SweepPlanResult : OperationResultConstructors
| Name | Description |
|---|---|
SweepPlanResult() |
Properties
| Name | Description |
|---|---|
Duplicates | Duplicate messages a dedup sweep would remove. |
ParkedFolders | Real folders outside the IPM subtree that a sweep would re-home. |
PrunableFolders | Empty folders a prune sweep would remove. |
RootOwnedMessages | Messages owned by the store root itself that a sweep would re-home. |
TablesUnreadable | 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. |
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 IntegerC#
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 IntegerC#
public int ParkedFolders { get; set; }Property value
Int32
PrunableFolders property
Empty folders a prune sweep would remove.
VB.NET
Public Property PrunableFolders As IntegerC#
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 IntegerC#
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 IntegerC#
public int TablesUnreadable { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
VolumeInfo class
One output volume produced by a capped merge.
VB.NET
Public NotInheritable Class VolumeInfoC#
public sealed class VolumeInfoConstructors
| Name | Description |
|---|---|
VolumeInfo() |
Properties
| Name | Description |
|---|---|
Messages | Messages 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 IntegerC#
public int Messages { get; set; }Property value
Int32
Path property
VB.NET
Public Property Path As StringC#
public string Path { get; set; }Property value
String
SizeBytes property
VB.NET
Public Property SizeBytes As LongC#
public long SizeBytes { get; set; }Property value
Int64
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Convert namespace
VolumeReport class
Outcome of a capped (volume-split) merge. ErrorCode 0 = success.
VB.NET
Public NotInheritable Class VolumeReport
Inherits OperationResultC#
public sealed class VolumeReport : OperationResultConstructors
| Name | Description |
|---|---|
VolumeReport() |
Properties
| Name | Description |
|---|---|
BlankMessagesRemoved | Blank mail removed (no subject, no body, no attachments). |
DuplicatesRemoved | |
FilteredOut | Messages left out by the item-type filter (keepKinds). |
FoldersRehomed | Real folders found outside a source's IPM subtree and re-homed under it. |
MessagesRehomed | Messages owned by a source's store root and re-homed into its IPM root. |
MessagesSkippedOversize | 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. |
SourcesSkipped | 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. |
TotalMessages | |
Verification | 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. |
Volumes | |
Warning | Non-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 IntegerC#
public int BlankMessagesRemoved { get; set; }Property value
Int32
DuplicatesRemoved property
VB.NET
Public Property DuplicatesRemoved As IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
public int SourcesSkipped { get; set; }Property value
Int32
TotalMessages property
VB.NET
Public Property TotalMessages As IntegerC#
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 MergeVerificationC#
public MergeVerification Verification { get; set; }Property value
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 StringC#
public string Warning { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Diagnostics namespace
Classes
| Name | Description |
|---|---|
ActivityEventArgs | Payload for DiagnosticsContext.Activity: one line of plain-language narrative, already fit to show a user, and when it happened. |
AnsiUpgradeEventArgs | 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. |
CorruptionEventArgs | Payload for DiagnosticsContext.SourceCorruptionDetected: which file, how bad, and (when auto-generated) where the developer support report was written. |
DiagEventArgs | Payload for DiagnosticsContext.Started / DiagnosticsContext.Completed. |
DiagnosticsContext | 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. |
ErrorEventArgs | Payload for DiagnosticsContext.ErrorOccurred: the failing phase, the error type and message, the item that failed, and whether the run recovered (skipped and continued). |
ItemRemovedEventArgs | 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. |
ModeEventArgs | Payload for DiagnosticsContext.ModeChosen: which mode an input was processed in. |
ProgressEventArgs | Payload for DiagnosticsContext.ReadProgress / DiagnosticsContext.WriteProgress. |
Enumerations
| Name | Description |
|---|---|
DiagPhase | Which side of an operation an event refers to. |
ProcessingMode | How a single input store is processed. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
ActivityEventArgs class
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 EventArgsC#
public sealed class ActivityEventArgs : EventArgsProperties
| Name | Description |
|---|---|
Line | |
TimestampUtc |
Details
Line property
VB.NET
Public ReadOnly Property Line As StringC#
public string Line { get; }Property value
String
TimestampUtc property
VB.NET
Public ReadOnly Property TimestampUtc As DateC#
public DateTime TimestampUtc { get; }Property value
DateTime
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
AnsiUpgradeEventArgs class
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 EventArgsC#
public sealed class AnsiUpgradeEventArgs : EventArgsProperties
| Name | Description |
|---|---|
Proceed | The decision: True to upgrade to Unicode, False (default) to abort without writing. |
SourcePath | The 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 BooleanC#
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 StringC#
public string SourcePath { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
CorruptionEventArgs class
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 EventArgsC#
public sealed class CorruptionEventArgs : EventArgsProperties
| Name | Description |
|---|---|
ErrorCount | Structural error count the scan found. |
Path | |
Summary | Sample of issue descriptions (offset + reason), enough for a log line. |
SupportReportPath | Path of the auto-generated support report, or Nothing. |
Details
ErrorCount property
Structural error count the scan found.
VB.NET
Public ReadOnly Property ErrorCount As IntegerC#
public int ErrorCount { get; }Property value
Int32
Path property
VB.NET
Public ReadOnly Property Path As StringC#
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 StringC#
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 StringC#
public string SupportReportPath { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
DiagEventArgs class
Payload for DiagnosticsContext.Started / DiagnosticsContext.Completed.
VB.NET
Public NotInheritable Class DiagEventArgs
Inherits EventArgsC#
public sealed class DiagEventArgs : EventArgsProperties
| Name | Description |
|---|---|
Message | |
Operation | |
TimestampUtc |
Details
Message property
VB.NET
Public ReadOnly Property Message As StringC#
public string Message { get; }Property value
String
Operation property
VB.NET
Public ReadOnly Property Operation As StringC#
public string Operation { get; }Property value
String
TimestampUtc property
VB.NET
Public ReadOnly Property TimestampUtc As DateC#
public DateTime TimestampUtc { get; }Property value
DateTime
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
DiagnosticsContext class
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 DiagnosticsContextC#
public sealed class DiagnosticsContextConstructors
| Name | Description |
|---|---|
DiagnosticsContext() |
Properties
| Name | Description |
|---|---|
AllowAnsiToUnicodeUpgrade | 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. |
AuditRemovals | 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. |
AutoSupportReport | 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. |
CancellationToken | 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. |
CorruptionDetected | True once any scanned source (or a repair's source validation) reported corruption. |
CreateUserLog | 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). |
EnableLogging | When true, every raised event is also written, in detail, to LogFilePath. |
InMemoryThresholdBytes | 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.) |
LogFilePath | Path 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 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. |
MessagesRead | 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. |
MessagesWritten | Messages written to the output. See MessagesRead. |
ProcessingMode | 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. |
RecoverFromCorruption | 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. |
ScanSourcesOnOpen | 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. |
SkipDuplicates | 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. |
SupportContact | 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. |
SupportReportDirectory | Directory for auto-generated support reports (default: the user's temp folder). |
UserLogLines | Everything written to the user log so far — hosts can show it in a UI instead of (or as well as) the file. |
UserLogPath | Path of the user log. If blank when the first line is written, defaults to %TEMP%\BastionPstSdk-UserLog-yyyyMMdd-HHmmss.txt. |
Methods
| Name | Description |
|---|---|
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
| Name | Description |
|---|---|
Activity | 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. |
AnsiUpgradeRequired | 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). |
Completed | Raised once when an operation finishes (after the output file is written). |
ErrorOccurred | Raised when a read or write step fails; includes the error type and reason. |
ItemRemoved | 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. |
ModeChosen | Raised once per input store with the processing mode chosen for it (and its size). |
ReadProgress | Raised as the source store is read/converted, item by item. |
SourceCorruptionDetected | Raised when a scanned source is corrupt. SupportReportPath is Nothing unless AutoSupportReport generated one. |
SourceProgress | 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. |
Started | Raised once when an operation begins its read pass. |
WriteProgress | Raised 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 BooleanC#
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 BooleanC#
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 BooleanC#
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 CancellationTokenC#
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 BooleanC#
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 BooleanC#
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 BooleanC#
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 LongC#
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 StringC#
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 LongC#
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 LongC#
public long MessagesRead { get; }Property value
Int64
MessagesWritten property
Messages written to the output. See MessagesRead.
VB.NET
Public ReadOnly Property MessagesWritten As LongC#
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 ProcessingModeC#
public ProcessingMode ProcessingMode { get; set; }Property value
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 BooleanC#
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 BooleanC#
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 BooleanC#
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 StringC#
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 StringC#
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 StringC#
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
processedInt64- Items done so far.
totalInt64- Items in total, or -1 when not known in advance.
itemString- 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
Which side of an operation an event refers to.
VB.NET
Public Enum DiagPhaseC#
public enum DiagPhaseMembers
| Name | Value | Description |
|---|---|---|
Read | 0 | |
Write | 1 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
ErrorEventArgs class
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 EventArgsC#
public sealed class ErrorEventArgs : EventArgsProperties
| Name | Description |
|---|---|
Context | What was being processed (e.g. a node NID or source path). |
Error | The underlying exception (may be Nothing). |
ErrorType | The exception type name, e.g. "EndOfStreamException". |
Message | |
Phase | |
Recovered | True 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 StringC#
public string Context { get; }Property value
String
Error property
The underlying exception (may be Nothing).
VB.NET
Public ReadOnly Property Error As ExceptionC#
public Exception Error { get; }Property value
Exception
ErrorType property
The exception type name, e.g. "EndOfStreamException".
VB.NET
Public ReadOnly Property ErrorType As StringC#
public string ErrorType { get; }Property value
String
Message property
VB.NET
Public ReadOnly Property Message As StringC#
public string Message { get; }Property value
String
Phase property
Property value
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 BooleanC#
public bool Recovered { get; }Property value
Boolean
TimestampUtc property
VB.NET
Public ReadOnly Property TimestampUtc As DateC#
public DateTime TimestampUtc { get; }Property value
DateTime
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
ItemRemovedEventArgs class
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 EventArgsC#
public sealed class ItemRemovedEventArgs : EventArgsProperties
| Name | Description |
|---|---|
Folder | Display name of the folder it was removed from. |
KeptCopy | Which copy survives, for a duplicate ("source:folder"). For a blank message nothing is kept, and this says so. |
MessageClass | The item's message class, e.g. "IPM.Note". |
Reason | 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". |
SenderName | Sender display name, or "" when the item carried none. |
Sent | Sent/delivery time as "yyyy-MM-dd HH:mm", or "" when the item carried none. |
Source | Label of the source store the removed item came from. |
Subject | Subject 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 StringC#
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 StringC#
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 StringC#
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 StringC#
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 StringC#
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 StringC#
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 StringC#
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 StringC#
public string Subject { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
ModeEventArgs class
Payload for DiagnosticsContext.ModeChosen: which mode an input was processed in.
VB.NET
Public NotInheritable Class ModeEventArgs
Inherits EventArgsC#
public sealed class ModeEventArgs : EventArgsProperties
| Name | Description |
|---|---|
Mode | |
Operation | |
Path | |
SizeBytes |
Details
Mode property
VB.NET
Public ReadOnly Property Mode As ProcessingModeC#
public ProcessingMode Mode { get; }Property value
Operation property
VB.NET
Public ReadOnly Property Operation As StringC#
public string Operation { get; }Property value
String
Path property
VB.NET
Public ReadOnly Property Path As StringC#
public string Path { get; }Property value
String
SizeBytes property
VB.NET
Public ReadOnly Property SizeBytes As LongC#
public long SizeBytes { get; }Property value
Int64
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
ProcessingMode enumeration
How a single input store is processed.
VB.NET
Public Enum ProcessingModeC#
public enum ProcessingModeMembers
| Name | Value | Description |
|---|---|---|
Auto | 0 | Decide per input from its size vs DiagnosticsContext.InMemoryThresholdBytes. |
InMemory | 1 | Buffer the input's converted nodes in memory (small inputs). |
Streaming | 2 | Stream the input node-by-node (bounded memory; any size). |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Diagnostics namespace
ProgressEventArgs class
Payload for DiagnosticsContext.ReadProgress / DiagnosticsContext.WriteProgress.
VB.NET
Public NotInheritable Class ProgressEventArgs
Inherits EventArgsC#
public sealed class ProgressEventArgs : EventArgsProperties
| Name | Description |
|---|---|
CurrentFile | 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. |
CurrentItem | |
PercentComplete | 0..100, or -1 when Total is unknown. |
Phase | |
Processed | |
TimestampUtc | |
Total | Total 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 StringC#
public string CurrentFile { get; }Property value
String
CurrentItem property
VB.NET
Public ReadOnly Property CurrentItem As StringC#
public string CurrentItem { get; }Property value
String
PercentComplete property
0..100, or -1 when Total is unknown.
VB.NET
Public ReadOnly Property PercentComplete As DoubleC#
public double PercentComplete { get; }Property value
Double
Phase property
Property value
Processed property
VB.NET
Public ReadOnly Property Processed As LongC#
public long Processed { get; }Property value
Int64
TimestampUtc property
VB.NET
Public ReadOnly Property TimestampUtc As DateC#
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 LongC#
public long Total { get; }Property value
Int64
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Export namespace
Classes
| Name | Description |
|---|---|
ExportReport | 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. |
ItemExporter | 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. |
MessageExporter | 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. |
StoreBuilder | 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). |
StoreExporter | 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. |
TextResult | Result of converting one item to text (.eml, .mhtml, .ics, .vcf): the standard error contract plus the text. |
Enumerations
| Name | Description |
|---|---|
ExportFormat | 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. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace
ExportFormat enumeration
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 ExportFormatC#
public enum ExportFormatMembers
| Name | Value | Description |
|---|---|---|
Eml | 0 | RFC 5322 / MIME internet message (.eml). |
Msg | 1 | Outlook message file (.msg), [MS-OXMSG] compound file. |
Ics | 2 | iCalendar appointment (.ics), RFC 5545 — appointment items only. |
Vcf | 3 | vCard contact (.vcf), RFC 6350 — contact items only. |
Mhtml | 4 | MIME HTML (.mhtml), RFC 2557 — a single-file web archive of the message. |
Mbox | 5 | Unix mbox (.mbox): every message in a folder concatenated into one file. |
Oft | 6 | Outlook 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
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 OperationResultC#
public sealed class ExportReport : OperationResultRemarks
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
| Name | Description |
|---|---|
ExportReport() |
Properties
| Name | Description |
|---|---|
Failed | 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. |
Failures | 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. |
FilesWritten | Number of items written to disk. Includes the ItemsIncomplete. |
FoldersUnreadable | 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. |
FoldersVisited | Number of folders visited. |
ItemsFound | 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. |
ItemsIncomplete | 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. |
Skipped | 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. |
Warning | Non-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 IntegerC#
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 IntegerC#
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 IntegerC#
public int FoldersUnreadable { get; set; }Property value
Int32
FoldersVisited property
Number of folders visited.
VB.NET
Public Property FoldersVisited As IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 StringC#
public string Warning { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace
ItemExporter class
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 ItemExporterC#
public sealed class ItemExporterRemarks
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
| Name | Description |
|---|---|
ExportIcs(PstMessage, String, Boolean) 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). |
ExportVcf(ContactView, String, Boolean) static | Write a projected contact ROW to a vCard file. Use this for a card that For an ordinary unmerged contact prefer the |
ExportVcf(PstMessage, String, Boolean) static | Write a contact message to a vCard (.vcf) file. |
ToIcs(PstMessage) 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. |
ToVcf(ContactView) 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. |
ToVcf(PstMessage) 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. |
TryToIcs(PstMessage) 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. |
TryToVcf(ContactView) static | Return a projected contact row as a vCard 3.0 string, with the outcome. |
TryToVcf(PstMessage) 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. |
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 FileOpResultC#
public static FileOpResult ExportIcs(PstMessage msg, string path, bool overwrite = true);Parameters
msgPstMessagepathStringoverwriteBoolean
Returns
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 FileOpResultC#
public static FileOpResult ExportVcf(ContactView contact, string path, bool overwrite = true);Parameters
contactContactViewpathStringoverwriteBoolean
Returns
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 FileOpResultC#
public static FileOpResult ExportVcf(PstMessage msg, string path, bool overwrite = true);Parameters
msgPstMessagepathStringoverwriteBoolean
Returns
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 StringC#
public static string ToIcs(PstMessage msg);Parameters
msgPstMessage
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 StringC#
public static string ToVcf(ContactView contact);Parameters
contactContactView
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 StringC#
public static string ToVcf(PstMessage msg);Parameters
msgPstMessage
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 TextResultC#
public static TextResult TryToIcs(PstMessage msg);Parameters
msgPstMessage
Returns
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 TextResultC#
public static TextResult TryToVcf(ContactView contact);Parameters
contactContactView
Returns
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 TextResultC#
public static TextResult TryToVcf(PstMessage msg);Parameters
msgPstMessage
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace
MessageExporter class
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 MessageExporterC#
public sealed class MessageExporterRemarks
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
| Name | Description |
|---|---|
ExportEml(PstMessage, String, Boolean) static | Write msg to path as a MIME .eml file. |
ExportMhtml(PstMessage, String, Boolean) static | Write msg to path as MIME HTML (.mhtml, RFC 2557) — a single-file web archive (HTML body plus inline resources). |
ExportMsg(PstMessage, String, Boolean) 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. |
ExportOft(PstMessage, String, Boolean) 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". |
ToEml(PstMessage) 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. |
ToMhtml(PstMessage) 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. |
TryToEml(PstMessage) static | Return msg as a MIME (.eml) string, with the outcome. TextResult.Text is Nothing when the message could not be read. |
TryToMhtml(PstMessage) static | Return 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 FileOpResultC#
public static FileOpResult ExportEml(PstMessage msg, string path, bool overwrite = true);Parameters
msgPstMessagepathStringoverwriteBoolean
Returns
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 FileOpResultC#
public static FileOpResult ExportMhtml(PstMessage msg, string path, bool overwrite = true);Parameters
msgPstMessagepathStringoverwriteBoolean
Returns
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 FileOpResultC#
public static FileOpResult ExportMsg(PstMessage msg, string path, bool overwrite = true);Parameters
msgPstMessagepathStringoverwriteBoolean
Returns
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 FileOpResultC#
public static FileOpResult ExportOft(PstMessage msg, string path, bool overwrite = true);Parameters
msgPstMessagepathStringoverwriteBoolean
Returns
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 StringC#
public static string ToEml(PstMessage msg);Parameters
msgPstMessage
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 StringC#
public static string ToMhtml(PstMessage msg);Parameters
msgPstMessage
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 TextResultC#
public static TextResult TryToEml(PstMessage msg);Parameters
msgPstMessage
Returns
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 TextResultC#
public static TextResult TryToMhtml(PstMessage msg);Parameters
msgPstMessage
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Export namespace
StoreBuilder class
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 StoreBuilderC#
public sealed class StoreBuilderMethods
| Name | Description |
|---|---|
CreateEmpty(String, Boolean, String) 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. |
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 FileOpResultC#
public static FileOpResult CreateEmpty(string path, bool overwrite = false, string storeName = null);Parameters
pathString- Destination .pst path.
overwriteBoolean- Replace the file if it already exists.
storeNameString- 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
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
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 StoreExporterC#
public sealed class StoreExporterMethods
| Name | Description |
|---|---|
ExportToFolder(String, String, ExportFormat, DiagnosticsContext, Boolean) 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). |
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 ExportReportC#
public static ExportReport ExportToFolder(
string pstPath,
string outDir,
ExportFormat format = ExportFormat.Eml,
DiagnosticsContext diag = null,
bool overwrite = true
);Parameters
pstPathStringoutDirStringformatExportFormatdiagDiagnosticsContextoverwriteBoolean- For
ExportFormat.Mbox: when False, an .mbox file that already exists stops the export withErrorCode.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
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
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 OperationResultC#
public sealed class TextResult : OperationResultConstructors
| Name | Description |
|---|---|
TextResult() |
Properties
| Name | Description |
|---|---|
Text | 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. |
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 StringC#
public string Text { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Import namespace
Classes
| Name | Description |
|---|---|
EmlReader | 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). |
IcsReader | 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). |
ImportedAddress | A name/email pair parsed from an address header. |
ImportedAppointment | Appointment fields parsed from an iCalendar VEVENT (RFC 5545). Attendees ride in the owning message's To list; SUMMARY/DESCRIPTION in Subject/BodyText. |
ImportedAttachment | An attachment parsed from an imported message. |
ImportedContact | Contact fields parsed from a vCard (RFC 6350 / 2425; 2.1–4.0 tolerated). |
ImportedDistList | Distribution-list fields ([MS-OXOABK]): the list name and its one-off members. |
ImportedDistListMember | A distribution-list member (a one-off recipient: display name + SMTP address). |
ImportedJournal | Journal-entry fields ([MS-OXOJRNL]). |
ImportedMessage | 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. |
ImportedNote | Sticky-note fields ([MS-OXONOTE]). The note text is the message BodyText. Color: 0 blue,1 green,2 pink,3 yellow (default),4 white. |
ImportedOccurrenceOverride | 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. |
ImportedRecurrence | 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. |
ImportedRss | RSS post fields ([MS-OXOPOST] / PSETID_PostRss). The article body is the message BodyText/BodyHtml; the channel is the feed the item arrived from. |
ImportedTask | Task 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, |
ImportReport | 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. |
ImportResult | Result of importing a single message: the standard error contract plus the message. |
MboxReader | Reads a Unix mbox file into ImportedMessages. Never throws (a licence refusal aside). |
MsgReader | 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). |
OlmReader | 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). |
StoreImporter | 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). |
TnefReader | Decodes TNEF (winmail.dat) streams into real attachments ([MS-OXTNEF]). Tolerant of damage; never throws into the caller (a licence refusal aside). |
TnefResult | Result of decoding a TNEF stream: the standard error contract, the recovered attachments and bodies, plus damage counters (bad checksums / truncated attributes). |
VcfReader | Reads a vCard (.vcf) file: yields each card as a contact-kind ImportedMessage. Malformed cards are skipped; never throws (a licence refusal aside). |
Enumerations
| Name | Description |
|---|---|
ImportedItemKind | 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. |
RecurDays | Days-of-week bitmask for a weekly recurrence (matches [MS-OXOCAL] PatternTypeWeek). |
RecurFrequency | Recurrence frequency for an authored or imported appointment. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
EmlReader class
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 EmlReaderC#
public sealed class EmlReaderRemarks
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
| Name | Description |
|---|---|
Parse(Byte[]) static | Parse raw .eml bytes into a message model. |
ParseFile(String) static | Parse 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 ImportResultC#
public static ImportResult Parse(byte[] bytes);Parameters
bytesByte[]
Returns
ParseFile(String) method static
Parse an .eml file into a message model.
VB.NET
Public Shared Function ParseFile(path As String) As ImportResultC#
public static ImportResult ParseFile(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
IcsReader class
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 IcsReaderC#
public sealed class IcsReaderMethods
| Name | Description |
|---|---|
Parse(String) 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. |
ReadFile(String) 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. |
TryReadFile(String) 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. |
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
textString
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
pathString
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 ImportManyResultC#
public static ImportManyResult TryReadFile(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedAddress class
A name/email pair parsed from an address header.
VB.NET
Public NotInheritable Class ImportedAddressC#
public sealed class ImportedAddressConstructors
| Name | Description |
|---|---|
ImportedAddress() |
Properties
| Name | Description |
|---|---|
Email | |
Name |
Methods
| Name | Description |
|---|---|
ToString() |
Details
ImportedAddress() constructor
VB.NET
Public Sub New()C#
public ImportedAddress();Email property
VB.NET
Public Property Email As StringC#
public string Email { get; set; }Property value
String
Name property
VB.NET
Public Property Name As StringC#
public string Name { get; set; }Property value
String
ToString() method
VB.NET
Public Overrides Function ToString() As StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedAppointment class
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 ImportedAppointmentC#
public sealed class ImportedAppointmentConstructors
| Name | Description |
|---|---|
ImportedAppointment() |
Properties
| Name | Description |
|---|---|
BusyStatus | olBusyStatus: 0 free, 1 tentative, 2 busy, 3 out of office. |
EndTime | |
IsAllDay | True for a VALUE=DATE (all-day) event. |
Location | |
Recurrence | Recurrence pattern, or Nothing for a single-instance appointment. |
ReminderMinutesBeforeStart | |
ReminderSet | |
StartTime | |
Uid | The 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 IntegerC#
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 BooleanC#
public bool IsAllDay { get; set; }Property value
Boolean
Location property
VB.NET
Public Property Location As StringC#
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 ImportedRecurrenceC#
public ImportedRecurrence Recurrence { get; set; }Property value
ReminderMinutesBeforeStart property
VB.NET
Public Property ReminderMinutesBeforeStart As IntegerC#
public int ReminderMinutesBeforeStart { get; set; }Property value
Int32
ReminderSet property
VB.NET
Public Property ReminderSet As BooleanC#
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 StringC#
public string Uid { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedAttachment class
An attachment parsed from an imported message.
VB.NET
Public NotInheritable Class ImportedAttachmentC#
public sealed class ImportedAttachmentConstructors
| Name | Description |
|---|---|
ImportedAttachment() |
Properties
| Name | Description |
|---|---|
ContentId | |
Data | |
EmbeddedMessage | 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. |
FileName | |
IsContactPhoto | True 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 StringC#
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 ImportedMessageC#
public ImportedMessage EmbeddedMessage { get; set; }Property value
FileName property
VB.NET
Public Property FileName As StringC#
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 BooleanC#
public bool IsContactPhoto { get; set; }Property value
Boolean
IsInline property
VB.NET
Public Property IsInline As BooleanC#
public bool IsInline { get; set; }Property value
Boolean
MimeType property
VB.NET
Public Property MimeType As StringC#
public string MimeType { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedContact class
Contact fields parsed from a vCard (RFC 6350 / 2425; 2.1–4.0 tolerated).
VB.NET
Public NotInheritable Class ImportedContactC#
public sealed class ImportedContactConstructors
| Name | Description |
|---|---|
ImportedContact() |
Properties
| Name | Description |
|---|---|
Anniversary | |
Birthday | |
BusinessAddress | Single-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 StringC#
public string BusinessAddress { get; set; }Property value
String
BusinessFax property
VB.NET
Public Property BusinessFax As StringC#
public string BusinessFax { get; set; }Property value
String
BusinessTelephone property
VB.NET
Public Property BusinessTelephone As StringC#
public string BusinessTelephone { get; set; }Property value
String
CompanyName property
VB.NET
Public Property CompanyName As StringC#
public string CompanyName { get; set; }Property value
String
Department property
VB.NET
Public Property Department As StringC#
public string Department { get; set; }Property value
String
DisplayName property
VB.NET
Public Property DisplayName As StringC#
public string DisplayName { get; set; }Property value
String
Email1Address property
VB.NET
Public Property Email1Address As StringC#
public string Email1Address { get; set; }Property value
String
Email2Address property
VB.NET
Public Property Email2Address As StringC#
public string Email2Address { get; set; }Property value
String
Email3Address property
VB.NET
Public Property Email3Address As StringC#
public string Email3Address { get; set; }Property value
String
GivenName property
VB.NET
Public Property GivenName As StringC#
public string GivenName { get; set; }Property value
String
HomeAddress property
VB.NET
Public Property HomeAddress As StringC#
public string HomeAddress { get; set; }Property value
String
HomeTelephone property
VB.NET
Public Property HomeTelephone As StringC#
public string HomeTelephone { get; set; }Property value
String
JobTitle property
VB.NET
Public Property JobTitle As StringC#
public string JobTitle { get; set; }Property value
String
MiddleName property
VB.NET
Public Property MiddleName As StringC#
public string MiddleName { get; set; }Property value
String
MobileTelephone property
VB.NET
Public Property MobileTelephone As StringC#
public string MobileTelephone { get; set; }Property value
String
Surname property
VB.NET
Public Property Surname As StringC#
public string Surname { get; set; }Property value
String
WebPage property
VB.NET
Public Property WebPage As StringC#
public string WebPage { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedDistList class
Distribution-list fields ([MS-OXOABK]): the list name and its one-off members.
VB.NET
Public NotInheritable Class ImportedDistListC#
public sealed class ImportedDistListConstructors
| Name | Description |
|---|---|
ImportedDistList() |
Properties
| Name | Description |
|---|---|
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 StringC#
public string Name { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedDistListMember class
A distribution-list member (a one-off recipient: display name + SMTP address).
VB.NET
Public NotInheritable Class ImportedDistListMemberC#
public sealed class ImportedDistListMemberConstructors
| Name | Description |
|---|---|
ImportedDistListMember() |
Properties
| Name | Description |
|---|---|
DisplayName | |
Email |
Details
ImportedDistListMember() constructor
VB.NET
Public Sub New()C#
public ImportedDistListMember();DisplayName property
VB.NET
Public Property DisplayName As StringC#
public string DisplayName { get; set; }Property value
String
Email property
VB.NET
Public Property Email As StringC#
public string Email { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedItemKind enumeration
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 ImportedItemKindC#
public enum ImportedItemKindMembers
| Name | Value | Description |
|---|---|---|
Mail | 0 | |
Appointment | 1 | |
Contact | 2 | |
Task | 3 | |
Note | 4 | |
Journal | 5 | |
DistributionList | 6 | |
Rss | 7 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedJournal class
Journal-entry fields ([MS-OXOJRNL]).
VB.NET
Public NotInheritable Class ImportedJournalC#
public sealed class ImportedJournalConstructors
| Name | Description |
|---|---|
ImportedJournal() |
Properties
| Name | Description |
|---|---|
DurationMinutes | |
EndTime | |
JournalType | Free-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 IntegerC#
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 StringC#
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
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 ImportedMessageC#
public sealed class ImportedMessageConstructors
| Name | Description |
|---|---|
ImportedMessage() |
Properties
| Name | Description |
|---|---|
Appointment | Appointment payload when Kind is Appointment, else Nothing. |
Attachments | |
Bcc | |
BodyHtml | |
BodyText | |
Cc | |
Contact | Contact payload when Kind is Contact, else Nothing. |
Date | |
DistList | Distribution-list payload when Kind is DistributionList, else Nothing. |
FromEmail | |
FromName | |
Headers | All raw header name/value pairs, in order. |
Importance | PidTagImportance: 0 low, 1 normal (default), 2 high. |
IsRead | 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. |
Journal | Journal payload when Kind is Journal, else Nothing. |
Kind | Item kind: Mail (default), or Appointment / Contact from the ICS / VCF readers. The importer composes the matching Outlook item class. |
MessageClass | 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. |
MessageId | |
Note | Note payload when Kind is Note, else Nothing. |
Rss | RSS-post payload when Kind is Rss, else Nothing. |
SourceFolder | 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. |
Subject | |
Task | Task payload when Kind is Task, else Nothing. |
To |
Methods
| Name | Description |
|---|---|
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 ImportedAppointmentC#
public ImportedAppointment Appointment { get; set; }Property value
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 StringC#
public string BodyHtml { get; set; }Property value
String
BodyText property
VB.NET
Public Property BodyText As StringC#
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 ImportedContactC#
public ImportedContact Contact { get; set; }Property value
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 ImportedDistListC#
public ImportedDistList DistList { get; set; }Property value
FromEmail property
VB.NET
Public Property FromEmail As StringC#
public string FromEmail { get; set; }Property value
String
FromName property
VB.NET
Public Property FromName As StringC#
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 IntegerC#
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 BooleanC#
public bool IsRead { get; set; }Property value
Boolean
Journal property
Journal payload when Kind is Journal, else Nothing.
VB.NET
Public Property Journal As ImportedJournalC#
public ImportedJournal Journal { get; set; }Property value
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 ImportedItemKindC#
public ImportedItemKind Kind { get; set; }Property value
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 StringC#
public string MessageClass { get; set; }Property value
String
MessageId property
VB.NET
Public Property MessageId As StringC#
public string MessageId { get; set; }Property value
String
Note property
Note payload when Kind is Note, else Nothing.
VB.NET
Public Property Note As ImportedNoteC#
public ImportedNote Note { get; set; }Property value
Rss property
RSS-post payload when Kind is Rss, else Nothing.
VB.NET
Public Property Rss As ImportedRssC#
public ImportedRss Rss { get; set; }Property value
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 StringC#
public string SourceFolder { get; set; }Property value
String
Subject property
VB.NET
Public Property Subject As StringC#
public string Subject { get; set; }Property value
String
Task property
Task payload when Kind is Task, else Nothing.
VB.NET
Public Property Task As ImportedTaskC#
public ImportedTask Task { get; set; }Property value
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedNote class
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 ImportedNoteC#
public sealed class ImportedNoteConstructors
| Name | Description |
|---|---|
ImportedNote() |
Properties
| Name | Description |
|---|---|
Color | |
Height | |
Width |
Details
ImportedNote() constructor
VB.NET
Public Sub New()C#
public ImportedNote();Color property
VB.NET
Public Property Color As IntegerC#
public int Color { get; set; }Property value
Int32
Height property
VB.NET
Public Property Height As IntegerC#
public int Height { get; set; }Property value
Int32
Width property
VB.NET
Public Property Width As IntegerC#
public int Width { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedOccurrenceOverride class
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 ImportedOccurrenceOverrideC#
public sealed class ImportedOccurrenceOverrideConstructors
| Name | Description |
|---|---|
ImportedOccurrenceOverride() |
Properties
| Name | Description |
|---|---|
NewBusyStatus | New olBusyStatus (0 free, 1 tentative, 2 busy, 3 OOF). Nothing = unchanged. |
NewEnd | New end. Nothing = NewStart + the series duration. |
NewLocation | New location for this occurrence only. Nothing = unchanged. |
NewStart | New start (date + time). Nothing = same day at the series start time. |
NewSubject | New subject for this occurrence only. Nothing = unchanged. |
OriginalDate | The 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 StringC#
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 StringC#
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 DateC#
public DateTime OriginalDate { get; set; }Property value
DateTime
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedRecurrence class
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 ImportedRecurrenceC#
public sealed class ImportedRecurrenceConstructors
| Name | Description |
|---|---|
ImportedRecurrence() |
Properties
| Name | Description |
|---|---|
DayOfMonth | 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. |
DaysOfWeek | 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"). |
EndDate | End on/after this date (Nothing = count-based or never-ending). |
ExcludedDates | 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). |
FirstDayOfWeek | The day a week starts on, which decides the weeks of an every-N-weeks series that falls on several days. Sunday unless set. |
Frequency | |
Interval | Interval: every N days / weeks / months / years. |
MonthOfYear | For Yearly: the month (1–12). 0 (the default) takes the month of the start. |
OccurrenceCount | End after this many occurrences (0 = use EndDate or run forever). |
OverriddenOccurrences | Single occurrences to OVERRIDE (move / re-title) — [MS-OXOCAL] exceptions. Each must target a date the pattern generates and not one in ExcludedDates. |
WeekOfMonth | 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. |
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 IntegerC#
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").
Property value
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 DayOfWeekC#
public DayOfWeek FirstDayOfWeek { get; set; }Property value
DayOfWeek
Frequency property
VB.NET
Public Property Frequency As RecurFrequencyC#
public RecurFrequency Frequency { get; set; }Property value
Interval property
Interval: every N days / weeks / months / years.
VB.NET
Public Property Interval As IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
public int WeekOfMonth { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedRss class
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 ImportedRssC#
public sealed class ImportedRssConstructors
| Name | Description |
|---|---|
ImportedRss() |
Properties
| Name | Description |
|---|---|
Channel | The channel's display name (PidLidPostRssChannel). |
ChannelUrl | The feed's channel URL (PidLidPostRssChannelLink). |
ItemGuid | The article's feed-unique id (PidLidPostRssItemGuid). |
ItemUrl | The 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 StringC#
public string Channel { get; set; }Property value
String
ChannelUrl property
The feed's channel URL (PidLidPostRssChannelLink).
VB.NET
Public Property ChannelUrl As StringC#
public string ChannelUrl { get; set; }Property value
String
ItemGuid property
The article's feed-unique id (PidLidPostRssItemGuid).
VB.NET
Public Property ItemGuid As StringC#
public string ItemGuid { get; set; }Property value
String
ItemUrl property
The article's own URL (PidLidPostRssItemLink).
VB.NET
Public Property ItemUrl As StringC#
public string ItemUrl { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportedTask class
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 ImportedTaskC#
public sealed class ImportedTaskConstructors
| Name | Description |
|---|---|
ImportedTask() |
Properties
| Name | Description |
|---|---|
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 StringC#
public string Owner { get; set; }Property value
String
PercentComplete property
VB.NET
Public Property PercentComplete As DoubleC#
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 IntegerC#
public int Status { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportManyResult class
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:
- the file is missing:
ErrorCode.FileNotFound; - the file is not a file of that kind:
ErrorCode.InvalidInputFile; - the file is of that kind and holds nothing:
ErrorCode.Okwith noMessagesandEntriesSeenzero.
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 OperationResultC#
public sealed class ImportManyResult : OperationResultConstructors
| Name | Description |
|---|---|
ImportManyResult() |
Properties
| Name | Description |
|---|---|
EntriesFailed | Entries that could not be read and are not in Messages. |
EntriesSeen | Entries the file held: messages in an mbox or .olm, events (and tasks) in an iCalendar file, cards in a vCard file. |
Messages | The items read. Never Nothing. |
Methods
| Name | Description |
|---|---|
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 IntegerC#
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 IntegerC#
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportReport class
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 OperationResultC#
public sealed class ImportReport : OperationResultConstructors
| Name | Description |
|---|---|
ImportReport() |
Properties
| Name | Description |
|---|---|
Failures | 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. |
FilesFailed | Input files from which nothing was imported (see Failures). Each is also one LossKind.Source record in OperationResult.Losses. |
FilesRead | Input files successfully parsed. |
FoldersCreated | Folders created to satisfy the target folder path. |
MessagesImported | Messages written into the output store. |
Methods
| Name | Description |
|---|---|
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 IntegerC#
public int FilesFailed { get; set; }Property value
Int32
FilesRead property
Input files successfully parsed.
VB.NET
Public Property FilesRead As IntegerC#
public int FilesRead { get; set; }Property value
Int32
FoldersCreated property
Folders created to satisfy the target folder path.
VB.NET
Public Property FoldersCreated As IntegerC#
public int FoldersCreated { get; set; }Property value
Int32
MessagesImported property
Messages written into the output store.
VB.NET
Public Property MessagesImported As IntegerC#
public int MessagesImported { get; set; }Property value
Int32
ToString() method
VB.NET
Public Overrides Function ToString() As StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
ImportResult class
Result of importing a single message: the standard error contract plus the message.
VB.NET
Public NotInheritable Class ImportResult
Inherits OperationResultC#
public sealed class ImportResult : OperationResultConstructors
| Name | Description |
|---|---|
ImportResult() |
Properties
| Name | Description |
|---|---|
Message |
Details
ImportResult() constructor
VB.NET
Public Sub New()C#
public ImportResult();Message property
VB.NET
Public Property Message As ImportedMessageC#
public ImportedMessage Message { get; set; }Property value
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
MboxReader class
Reads a Unix mbox file into ImportedMessages. Never throws (a licence refusal aside).
VB.NET
Public NotInheritable Class MboxReaderC#
public sealed class MboxReaderRemarks
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
| Name | Description |
|---|---|
ReadFile(String) 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. |
TryReadFile(String) 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). |
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
pathString
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 ImportManyResultC#
public static ImportManyResult TryReadFile(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
MsgReader class
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 MsgReaderC#
public sealed class MsgReaderRemarks
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
| Name | Description |
|---|---|
Parse(Byte[]) static | Parse raw .msg bytes into a message model. |
ParseFile(String) static | Parse 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 ImportResultC#
public static ImportResult Parse(byte[] bytes);Parameters
bytesByte[]
Returns
ParseFile(String) method static
Parse a .msg file into a message model.
VB.NET
Public Shared Function ParseFile(path As String) As ImportResultC#
public static ImportResult ParseFile(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
OlmReader class
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 OlmReaderC#
public sealed class OlmReaderMethods
| Name | Description |
|---|---|
ReadFile(String) 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. |
TryReadFile(String) 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). |
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
pathString
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 ImportManyResultC#
public static ImportManyResult TryReadFile(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
RecurDays enumeration
Days-of-week bitmask for a weekly recurrence (matches [MS-OXOCAL] PatternTypeWeek).
VB.NET
<Flags>
Public Enum RecurDaysC#
[Flags]
public enum RecurDaysMembers
| Name | Value | Description |
|---|---|---|
None | 0 | |
Sunday | 1 | |
Monday | 2 | |
Tuesday | 4 | |
Wednesday | 8 | |
Thursday | 16 | |
Friday | 32 | |
Saturday | 64 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
RecurFrequency enumeration
Recurrence frequency for an authored or imported appointment.
VB.NET
Public Enum RecurFrequencyC#
public enum RecurFrequencyMembers
| Name | Value | Description |
|---|---|---|
None | 0 | |
Daily | 1 | |
Weekly | 2 | |
Monthly | 3 | |
Yearly | 4 | Every N years, in one month of the year. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
StoreImporter class
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 StoreImporterC#
public sealed class StoreImporterMethods
| Name | Description |
|---|---|
CloneStructure(String, String, DiagnosticsContext, Boolean, String) 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. |
CreateFolders(String, String, String, DiagnosticsContext, Boolean, String) 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. |
ImportFile(String, String, String, String, DiagnosticsContext, Boolean, String) 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. |
ImportFiles(String, String, IEnumerable<String>, String, DiagnosticsContext, Boolean, String) 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. |
ImportMbox(String, String, String, String, DiagnosticsContext, Boolean, String) 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. |
ImportMessages(String, String, IEnumerable<ImportedMessage>, String, DiagnosticsContext, Boolean, String) 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. |
ImportMessagesByFolder(String, String, IEnumerable<ImportedMessage>, String, IEnumerable<String>, DiagnosticsContext, Boolean, String) 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. |
ImportOlm(String, String, DiagnosticsContext, Boolean, String) 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). |
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 ImportReportC#
public static ImportReport CloneStructure(
string sourcePath,
string outPath,
DiagnosticsContext diag = null,
bool overwrite = false,
string storeName = null
);Parameters
sourcePathStringoutPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport CreateFolders(
string pstPath,
string outPath,
string folderPath,
DiagnosticsContext diag = null,
bool overwrite = true,
string storeName = null
);Parameters
pstPathStringoutPathStringfolderPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport ImportFile(
string pstPath,
string outPath,
string filePath,
string folderPath = "Imported",
DiagnosticsContext diag = null,
bool overwrite = false,
string storeName = null
);Parameters
pstPathStringoutPathStringfilePathStringfolderPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport ImportFiles(
string pstPath,
string outPath,
IEnumerable<string> files,
string folderPath = "Imported",
DiagnosticsContext diag = null,
bool overwrite = false,
string storeName = null
);Parameters
pstPathStringoutPathStringfilesIEnumerable<String>folderPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport ImportMbox(
string pstPath,
string outPath,
string mboxPath,
string folderPath = "Imported",
DiagnosticsContext diag = null,
bool overwrite = false,
string storeName = null
);Parameters
pstPathStringoutPathStringmboxPathStringfolderPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport ImportMessages(
string pstPath,
string outPath,
IEnumerable<ImportedMessage> messages,
string folderPath = "Imported",
DiagnosticsContext diag = null,
bool overwrite = false,
string storeName = null
);Parameters
pstPathStringoutPathStringmessagesIEnumerable<ImportedMessage>folderPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
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
pstPathStringoutPathStringmessagesIEnumerable<ImportedMessage>defaultFolderStringextraFoldersIEnumerable<String>diagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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 ImportReportC#
public static ImportReport ImportOlm(
string olmPath,
string outPath,
DiagnosticsContext diag = null,
bool overwrite = false,
string storeName = null
);Parameters
olmPathStringoutPathStringdiagDiagnosticsContextoverwriteBooleanstoreNameString
Returns
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
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 TnefReaderC#
public sealed class TnefReaderRemarks
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
| Name | Description |
|---|---|
IsTnef(Byte[]) static | True when the buffer starts with the TNEF signature. |
Parse(Byte[]) static | Decode a TNEF stream. Damage is tolerated: unreadable tails are dropped, checksum mismatches are counted, and everything recoverable is returned. |
ParseFile(String) static | Decode a TNEF file (e.g. a saved winmail.dat). |
Fields
| Name | Description |
|---|---|
Signature static | The 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 BooleanC#
public static bool IsTnef(byte[] data);Parameters
dataByte[]
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 TnefResultC#
public static TnefResult Parse(byte[] data);Parameters
dataByte[]
Returns
ParseFile(String) method static
Decode a TNEF file (e.g. a saved winmail.dat).
VB.NET
Public Shared Function ParseFile(path As String) As TnefResultC#
public static TnefResult ParseFile(string path);Parameters
pathString
Returns
Signature field static
The TNEF stream signature ([MS-OXTNEF] 2.1.3.1).
VB.NET
Public Const Signature As UInteger = 574529400C#
public const uint Signature = 574529400;Field value
UInt32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
TnefResult class
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 OperationResultC#
public sealed class TnefResult : OperationResultConstructors
| Name | Description |
|---|---|
TnefResult() |
Properties
| Name | Description |
|---|---|
Attachments | The real attachments recovered from the TNEF stream. |
AttachmentsWithoutData | 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. |
AttributesRead | Attributes successfully walked. |
BodyHtml | HTML body carried in the MAPI property list (PidTagBodyHtml), if any. |
BodyText | Plain-text body carried in attBody, if any. |
ChecksumErrors | Attributes whose 16-bit checksum did not match (content still used). |
PropertyListsIncomplete | MAPI property lists that could not be read to their end. Names, MIME types or content taken from such a list may be missing. |
Truncated | True when the stream ended mid-attribute (truncated file); everything recovered up to that point is still returned. |
Methods
| Name | Description |
|---|---|
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 IntegerC#
public int AttachmentsWithoutData { get; set; }Property value
Int32
AttributesRead property
Attributes successfully walked.
VB.NET
Public Property AttributesRead As IntegerC#
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 StringC#
public string BodyHtml { get; set; }Property value
String
BodyText property
Plain-text body carried in attBody, if any.
VB.NET
Public Property BodyText As StringC#
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 IntegerC#
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 IntegerC#
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 BooleanC#
public bool Truncated { get; set; }Property value
Boolean
ToString() method
VB.NET
Public Overrides Function ToString() As StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Import namespace
VcfReader class
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 VcfReaderC#
public sealed class VcfReaderMethods
| Name | Description |
|---|---|
Parse(String) 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. |
ReadFile(String) 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. |
TryReadFile(String) 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). |
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
textString
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
pathString
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 ImportManyResultC#
public static ImportManyResult TryReadFile(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Messaging namespace
Classes
| Name | Description |
|---|---|
AppointmentItem | |
AppointmentRecurrence | 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. |
Attachment | |
ContactItem | |
DistListMember | One member of a distribution list: who they are, and where mail to them goes. |
DistributionListItem | |
Folder | A folder of an opened store: its properties, its subfolders and its items. |
FolderClass | 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. |
Item | |
JournalItem | |
MailItem | |
MessageQuery | |
ModifiedOccurrence | One occurrence of a recurring appointment that was changed on its own: moved to another time, or given its own subject or location. |
NoteItem | |
OpenResult | Result of PersonalStorage.TryOpen: ErrorCode 0 = opened, Store usable. |
PersonalStorage | An opened PST or OST file: the way in to its folders and items. |
PstMessage | A message or other item (contact, appointment, task, note) of an opened store. |
Recipient | |
SearchEngine | Walks a folder subtree applying a MessageQuery. |
SearchHit | A search result: the message and the folder path it was found in. |
TaskItem |
Interfaces
| Name | Description |
|---|---|
IAppointmentItem | Appointment / meeting — [MS-OXOCAL]. |
IContactItem | Contact — [MS-OXOCNTC]. |
IDistributionListItem | Distribution list — [MS-OXOABK] / [MS-OXODLGT]. |
IItem | Common projection shared by every typed item. |
IJournalItem | Journal entry — [MS-OXOJRNL]. |
IMailItem | Mail message — [MS-OXOMSG]. |
INoteItem | Sticky note — [MS-OXONOTE]. The note text is IItem.Body. |
ITaskItem | Task — [MS-OXOTASK]. |
Enumerations
| Name | Description |
|---|---|
AttachMethod | PidTagAttachMethod (0x3705) — how an attachment's data is stored. |
BusyStatus | PidLidBusyStatus (PSETID_Appointment 0x8205) — free/busy for an appointment. |
Importance | PidTagImportance (0x0017). |
ItemKind | The kind of MAPI item, derived from PidTagMessageClass. |
RecipientType | PidTagRecipientType (0x0C15) — the role of a recipient on a message. |
RecurrenceEndKind | How a recurring series ends. |
Sensitivity | PidTagSensitivity (0x0036). |
TaskStatus | PidLidTaskStatus (PSETID_Task 0x8101). |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
AppointmentItem class
VB.NET
Public NotInheritable Class AppointmentItem
Inherits Item
Implements IAppointmentItemC#
public sealed class AppointmentItem : Item, IAppointmentItemProperties
| Name | Description |
|---|---|
AllAttendees | |
Attendees | |
BusyStatus | |
DurationMinutes | |
EndTime | |
IsAllDay | |
IsRecurring | |
Location | |
Recurrence | 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. |
RecurrenceUnreadableReason | Why 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 StringC#
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 BusyStatusC#
public BusyStatus BusyStatus { get; }Property value
DurationMinutes property
VB.NET
Public ReadOnly Property DurationMinutes As IntegerC#
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 BooleanC#
public bool IsAllDay { get; }Property value
Boolean
IsRecurring property
VB.NET
Public ReadOnly Property IsRecurring As BooleanC#
public bool IsRecurring { get; }Property value
Boolean
Location property
VB.NET
Public ReadOnly Property Location As StringC#
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 AppointmentRecurrenceC#
public AppointmentRecurrence Recurrence { get; }Property value
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 StringC#
public string RecurrenceUnreadableReason { get; }Property value
String
ReminderMinutesBeforeStart property
VB.NET
Public ReadOnly Property ReminderMinutesBeforeStart As IntegerC#
public int ReminderMinutesBeforeStart { get; }Property value
Int32
ReminderSet property
VB.NET
Public ReadOnly Property ReminderSet As BooleanC#
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
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 AppointmentRecurrenceC#
public sealed class AppointmentRecurrenceRemarks
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
| Name | Description |
|---|---|
DayOfMonth | 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). |
DaysOfWeek | 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. |
DeletedOccurrences | The days of occurrences that were deleted from the series, in order: days on the series' own calendar, at midnight, of no Kind. |
DurationMinutes | How long each occurrence lasts, in minutes. |
EndDate | The last day the series can fall on, at midnight on its own calendar, when it ends on a date. Nothing otherwise. |
EndKind | Whether the series ends, and how. |
FirstStartUtc | The first occurrence's start (UTC), as the pattern has it. |
Frequency | Daily, weekly, monthly or yearly. |
Interval | Every how many days, weeks, months or years (1 or more). |
ModifiedOccurrences | 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. |
MonthOfYear | For a yearly series: the month (1 to 12). 0 otherwise. |
OccurrenceCount | 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. |
TimeZoneDescription | The description of the time zone stored with the series, as whoever wrote the item gave it; Nothing when none is stored. |
TimeZoneId | 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. |
WeekOfMonth | 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. |
Methods
| Name | Description |
|---|---|
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
| Name | Description |
|---|---|
MaxOccurrencesPerWindow static | The 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 IntegerC#
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.
Property value
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 IntegerC#
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 RecurrenceEndKindC#
public RecurrenceEndKind EndKind { get; }Property value
FirstStartUtc property
The first occurrence's start (UTC), as the pattern has it.
VB.NET
Public ReadOnly Property FirstStartUtc As DateC#
public DateTime FirstStartUtc { get; }Property value
DateTime
Frequency property
Daily, weekly, monthly or yearly.
VB.NET
Public ReadOnly Property Frequency As RecurFrequencyC#
public RecurFrequency Frequency { get; }Property value
Interval property
Every how many days, weeks, months or years (1 or more).
VB.NET
Public ReadOnly Property Interval As IntegerC#
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 IntegerC#
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 IntegerC#
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 StringC#
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 StringC#
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 IntegerC#
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
fromUtcDateTime- The start of the window (included). A Date of no kind is taken as UTC.
toUtcDateTime- The end of the window (excluded).
Returns
IReadOnlyList<DateTime>
Exceptions
| Exception | Condition |
|---|---|
ArgumentException | The 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 = 10000C#
public const int MaxOccurrencesPerWindow = 10000;Field value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
Attachment class
VB.NET
Public NotInheritable Class AttachmentC#
public sealed class AttachmentProperties
| Name | Description |
|---|---|
ContentId | 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. |
FileName | Best file name: long name, then short (8.3) name, then display name. |
IsEmbeddedMessage | |
Method | |
MimeTag | |
Size |
Methods
| Name | Description |
|---|---|
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 StringC#
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 StringC#
public string FileName { get; }Property value
String
IsEmbeddedMessage property
VB.NET
Public ReadOnly Property IsEmbeddedMessage As BooleanC#
public bool IsEmbeddedMessage { get; }Property value
Boolean
Method property
VB.NET
Public ReadOnly Property Method As AttachMethodC#
public AttachMethod Method { get; }Property value
MimeTag property
VB.NET
Public ReadOnly Property MimeTag As StringC#
public string MimeTag { get; }Property value
String
Size property
VB.NET
Public ReadOnly Property Size As IntegerC#
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 PstMessageC#
public PstMessage GetEmbeddedMessage();Returns
Exceptions
| Exception | Condition |
|---|---|
InvalidDataException | The 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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
AttachMethod enumeration
PidTagAttachMethod (0x3705) — how an attachment's data is stored.
VB.NET
Public Enum AttachMethodC#
public enum AttachMethodMembers
| Name | Value | Description |
|---|---|---|
None | 0 | |
ByValue | 1 | |
ByReference | 2 | |
ByReferenceResolve | 3 | |
ByReferenceOnly | 4 | |
EmbeddedMessage | 5 | |
Storage | 6 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
BusyStatus enumeration
PidLidBusyStatus (PSETID_Appointment 0x8205) — free/busy for an appointment.
VB.NET
Public Enum BusyStatusC#
public enum BusyStatusMembers
| Name | Value | Description |
|---|---|---|
Free | 0 | |
Tentative | 1 | |
Busy | 2 | |
OutOfOffice | 3 | |
WorkingElsewhere | 4 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
ContactItem class
VB.NET
Public NotInheritable Class ContactItem
Inherits Item
Implements IContactItemC#
public sealed class ContactItem : Item, IContactItemProperties
| Name | Description |
|---|---|
Anniversary | The contact's wedding anniversary, at midnight (a calendar day, as Birthday). Nothing when none is recorded. |
Birthday | The 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 StringC#
public string BusinessAddress { get; }Property value
String
BusinessFax property
VB.NET
Public ReadOnly Property BusinessFax As StringC#
public string BusinessFax { get; }Property value
String
BusinessTelephone property
VB.NET
Public ReadOnly Property BusinessTelephone As StringC#
public string BusinessTelephone { get; }Property value
String
CompanyName property
VB.NET
Public ReadOnly Property CompanyName As StringC#
public string CompanyName { get; }Property value
String
Department property
VB.NET
Public ReadOnly Property Department As StringC#
public string Department { get; }Property value
String
DisplayName property
VB.NET
Public ReadOnly Property DisplayName As StringC#
public string DisplayName { get; }Property value
String
Email1Address property
VB.NET
Public ReadOnly Property Email1Address As StringC#
public string Email1Address { get; }Property value
String
Email1DisplayName property
VB.NET
Public ReadOnly Property Email1DisplayName As StringC#
public string Email1DisplayName { get; }Property value
String
Email2Address property
VB.NET
Public ReadOnly Property Email2Address As StringC#
public string Email2Address { get; }Property value
String
Email3Address property
VB.NET
Public ReadOnly Property Email3Address As StringC#
public string Email3Address { get; }Property value
String
FileUnder property
VB.NET
Public ReadOnly Property FileUnder As StringC#
public string FileUnder { get; }Property value
String
GivenName property
VB.NET
Public ReadOnly Property GivenName As StringC#
public string GivenName { get; }Property value
String
HomeAddress property
VB.NET
Public ReadOnly Property HomeAddress As StringC#
public string HomeAddress { get; }Property value
String
HomeTelephone property
VB.NET
Public ReadOnly Property HomeTelephone As StringC#
public string HomeTelephone { get; }Property value
String
JobTitle property
VB.NET
Public ReadOnly Property JobTitle As StringC#
public string JobTitle { get; }Property value
String
MiddleName property
VB.NET
Public ReadOnly Property MiddleName As StringC#
public string MiddleName { get; }Property value
String
MobileTelephone property
VB.NET
Public ReadOnly Property MobileTelephone As StringC#
public string MobileTelephone { get; }Property value
String
Nickname property
VB.NET
Public ReadOnly Property Nickname As StringC#
public string Nickname { get; }Property value
String
OfficeLocation property
VB.NET
Public ReadOnly Property OfficeLocation As StringC#
public string OfficeLocation { get; }Property value
String
Surname property
VB.NET
Public ReadOnly Property Surname As StringC#
public string Surname { get; }Property value
String
WebPage property
VB.NET
Public ReadOnly Property WebPage As StringC#
public string WebPage { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
DistListMember class
One member of a distribution list: who they are, and where mail to them goes.
VB.NET
Public NotInheritable Class DistListMemberC#
public sealed class DistListMemberConstructors
| Name | Description |
|---|---|
DistListMember() |
Properties
| Name | Description |
|---|---|
Address | |
AddressType | |
DisplayName |
Methods
| Name | Description |
|---|---|
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 StringC#
public string Address { get; set; }Property value
String
AddressType property
VB.NET
Public Property AddressType As StringC#
public string AddressType { get; set; }Property value
String
DisplayName property
VB.NET
Public Property DisplayName As StringC#
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
DistributionListItem class
VB.NET
Public NotInheritable Class DistributionListItem
Inherits Item
Implements IDistributionListItemC#
public sealed class DistributionListItem : Item, IDistributionListItemProperties
| Name | Description |
|---|---|
MemberCount | Member count from PidLidDistributionListMembers — a PtypMultipleBinary whose value begins with a 4-byte element count ([MS-OXCDATA] 2.11.1.5). 0 if absent. |
Members | 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. |
MembersUnreadable | 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. |
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 IntegerC#
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 IntegerC#
public int MembersUnreadable { get; }Property value
Int32
Name property
VB.NET
Public ReadOnly Property Name As StringC#
public string Name { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
Folder class
A folder of an opened store: its properties, its subfolders and its items.
VB.NET
Public NotInheritable Class FolderC#
public sealed class FolderRemarks
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
| Name | Description |
|---|---|
ContainerClass | 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). |
ContentCount | |
DisplayName | |
HasSubfolders | |
UnreadableTable | 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. |
UnreadCount |
Methods
| Name | Description |
|---|---|
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 StringC#
public string ContainerClass { get; }Property value
String
ContentCount property
VB.NET
Public ReadOnly Property ContentCount As IntegerC#
public int ContentCount { get; }Property value
Int32
DisplayName property
VB.NET
Public ReadOnly Property DisplayName As StringC#
public string DisplayName { get; }Property value
String
HasSubfolders property
VB.NET
Public ReadOnly Property HasSubfolders As BooleanC#
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 BooleanC#
public bool UnreadableTable { get; }Property value
Boolean
UnreadCount property
VB.NET
Public ReadOnly Property UnreadCount As IntegerC#
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 PstMessageC#
public PstMessage OpenMessage(uint nodeId);Parameters
nodeIdUInt32
Returns
Search(MessageQuery) method
Search this folder and its subfolders for messages matching query.
VB.NET
Public Function Search(query As MessageQuery) As IEnumerable(Of SearchHit)C#
public IEnumerable<SearchHit> Search(MessageQuery query);Parameters
queryMessageQuery
Returns
IEnumerable<SearchHit>
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
FolderClass class
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 FolderClassC#
public sealed class FolderClassRemarks
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
| Name | Description |
|---|---|
Appointment static | Calendar items — "IPF.Appointment". |
Birthday static | The birthday calendar Outlook maintains — "IPF.Appointment.Birthday". |
Contact static | Contacts — "IPF.Contact". |
Homepage static | A folder homepage — "IPF.Note.OutlookHomepage". |
Journal static | Journal entries — "IPF.Journal". |
Mail static | Mail and post items — "IPF.Note". The default for a new folder. |
StickyNote static | Sticky notes — "IPF.StickyNote". |
Task static | Tasks — "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
Appointment / meeting — [MS-OXOCAL].
Properties
| Name | Description |
|---|---|
AllAttendees | |
Attendees | Meeting attendees (the message recipients). |
BusyStatus | |
DurationMinutes | |
EndTime | |
IsAllDay | |
IsRecurring | |
Location | |
ReminderMinutesBeforeStart | |
ReminderSet | |
StartTime |
Details
AllAttendees property
VB.NET
ReadOnly Property AllAttendees As StringC#
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 BusyStatusC#
BusyStatus BusyStatus { get; }Property value
DurationMinutes property
VB.NET
ReadOnly Property DurationMinutes As IntegerC#
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 BooleanC#
bool IsAllDay { get; }Property value
Boolean
IsRecurring property
VB.NET
ReadOnly Property IsRecurring As BooleanC#
bool IsRecurring { get; }Property value
Boolean
Location property
VB.NET
ReadOnly Property Location As StringC#
string Location { get; }Property value
String
ReminderMinutesBeforeStart property
VB.NET
ReadOnly Property ReminderMinutesBeforeStart As IntegerC#
int ReminderMinutesBeforeStart { get; }Property value
Int32
ReminderSet property
VB.NET
ReadOnly Property ReminderSet As BooleanC#
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
Contact — [MS-OXOCNTC].
Properties
| Name | Description |
|---|---|
Anniversary | |
Birthday | |
BusinessAddress | Composed mailing (business) address. |
BusinessFax | |
BusinessTelephone | |
CompanyName | |
Department | |
DisplayName | |
Email1Address | |
Email1DisplayName | |
Email2Address | |
Email3Address | |
FileUnder | |
GivenName | |
HomeAddress | Composed 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 StringC#
string BusinessAddress { get; }Property value
String
BusinessFax property
VB.NET
ReadOnly Property BusinessFax As StringC#
string BusinessFax { get; }Property value
String
BusinessTelephone property
VB.NET
ReadOnly Property BusinessTelephone As StringC#
string BusinessTelephone { get; }Property value
String
CompanyName property
VB.NET
ReadOnly Property CompanyName As StringC#
string CompanyName { get; }Property value
String
Department property
VB.NET
ReadOnly Property Department As StringC#
string Department { get; }Property value
String
DisplayName property
VB.NET
ReadOnly Property DisplayName As StringC#
string DisplayName { get; }Property value
String
Email1Address property
VB.NET
ReadOnly Property Email1Address As StringC#
string Email1Address { get; }Property value
String
Email1DisplayName property
VB.NET
ReadOnly Property Email1DisplayName As StringC#
string Email1DisplayName { get; }Property value
String
Email2Address property
VB.NET
ReadOnly Property Email2Address As StringC#
string Email2Address { get; }Property value
String
Email3Address property
VB.NET
ReadOnly Property Email3Address As StringC#
string Email3Address { get; }Property value
String
FileUnder property
VB.NET
ReadOnly Property FileUnder As StringC#
string FileUnder { get; }Property value
String
GivenName property
VB.NET
ReadOnly Property GivenName As StringC#
string GivenName { get; }Property value
String
HomeAddress property
Composed home address.
VB.NET
ReadOnly Property HomeAddress As StringC#
string HomeAddress { get; }Property value
String
HomeTelephone property
VB.NET
ReadOnly Property HomeTelephone As StringC#
string HomeTelephone { get; }Property value
String
JobTitle property
VB.NET
ReadOnly Property JobTitle As StringC#
string JobTitle { get; }Property value
String
MiddleName property
VB.NET
ReadOnly Property MiddleName As StringC#
string MiddleName { get; }Property value
String
MobileTelephone property
VB.NET
ReadOnly Property MobileTelephone As StringC#
string MobileTelephone { get; }Property value
String
Nickname property
VB.NET
ReadOnly Property Nickname As StringC#
string Nickname { get; }Property value
String
OfficeLocation property
VB.NET
ReadOnly Property OfficeLocation As StringC#
string OfficeLocation { get; }Property value
String
Surname property
VB.NET
ReadOnly Property Surname As StringC#
string Surname { get; }Property value
String
WebPage property
VB.NET
ReadOnly Property WebPage As StringC#
string WebPage { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
IDistributionListItem interface
Distribution list — [MS-OXOABK] / [MS-OXODLGT].
VB.NET
Public Interface IDistributionListItem
Inherits IItemC#
public interface IDistributionListItem : IItemProperties
| Name | Description |
|---|---|
MemberCount | Number of members (count from PidLidDistributionListMembers); 0 if absent. |
Members | The 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 IntegerC#
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 StringC#
string Name { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
IItem interface
Common projection shared by every typed item.
VB.NET
Public Interface IItemC#
public interface IItemProperties
| Name | Description |
|---|---|
Body | Plain-text body (PidTagBody). |
CreationTime | |
Kind | Item kind from PidTagMessageClass. |
LastModificationTime | |
Message | The underlying raw message (escape hatch to the full PC / named props). |
MessageClass | PidTagMessageClass verbatim (e.g. "IPM.Appointment"). |
Subject |
Details
Body property
Plain-text body (PidTagBody).
VB.NET
ReadOnly Property Body As StringC#
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.
Property value
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 PstMessageC#
PstMessage Message { get; }Property value
MessageClass property
PidTagMessageClass verbatim (e.g. "IPM.Appointment").
VB.NET
ReadOnly Property MessageClass As StringC#
string MessageClass { get; }Property value
String
Subject property
VB.NET
ReadOnly Property Subject As StringC#
string Subject { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
IJournalItem interface
Journal entry — [MS-OXOJRNL].
Properties
| Name | Description |
|---|---|
DurationMinutes | |
EndTime | |
JournalType | |
StartTime |
Details
DurationMinutes property
VB.NET
ReadOnly Property DurationMinutes As IntegerC#
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 StringC#
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
Mail message — [MS-OXOMSG].
Properties
| Name | Description |
|---|---|
Attachments | |
BodyHtml | |
ConversationTopic | |
DeliveryTime | |
DisplayBcc | |
DisplayCc | |
DisplayTo | |
HasAttachments | |
Importance | |
InternetMessageId | |
IsHtmlFormat | 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. |
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 StringC#
string BodyHtml { get; }Property value
String
ConversationTopic property
VB.NET
ReadOnly Property ConversationTopic As StringC#
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 StringC#
string DisplayBcc { get; }Property value
String
DisplayCc property
VB.NET
ReadOnly Property DisplayCc As StringC#
string DisplayCc { get; }Property value
String
DisplayTo property
VB.NET
ReadOnly Property DisplayTo As StringC#
string DisplayTo { get; }Property value
String
HasAttachments property
VB.NET
ReadOnly Property HasAttachments As BooleanC#
bool HasAttachments { get; }Property value
Boolean
Importance property
VB.NET
ReadOnly Property Importance As ImportanceC#
Importance Importance { get; }Property value
InternetMessageId property
VB.NET
ReadOnly Property InternetMessageId As StringC#
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 BooleanC#
bool IsHtmlFormat { get; }Property value
Boolean
IsUnread property
VB.NET
ReadOnly Property IsUnread As BooleanC#
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 StringC#
string SenderEmail { get; }Property value
String
SenderName property
VB.NET
ReadOnly Property SenderName As StringC#
string SenderName { get; }Property value
String
Sensitivity property
VB.NET
ReadOnly Property Sensitivity As SensitivityC#
Sensitivity Sensitivity { get; }Property value
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
PidTagImportance (0x0017).
VB.NET
Public Enum ImportanceC#
public enum ImportanceMembers
| Name | Value | Description |
|---|---|---|
Low | 0 | |
Normal | 1 | |
High | 2 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
INoteItem interface
Sticky note — [MS-OXONOTE]. The note text is IItem.Body.
Properties
| Name | Description |
|---|---|
Color | PidLidNoteColor (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 IntegerC#
int Color { get; }Property value
Int32
Height property
VB.NET
ReadOnly Property Height As IntegerC#
int Height { get; }Property value
Int32
Width property
VB.NET
ReadOnly Property Width As IntegerC#
int Width { get; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
ITaskItem interface
Task — [MS-OXOTASK].
Properties
| Name | Description |
|---|---|
DateCompleted | |
DueDate | |
Importance | |
IsComplete | |
Owner | |
PercentComplete | Fraction 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 ImportanceC#
Importance Importance { get; }Property value
IsComplete property
VB.NET
ReadOnly Property IsComplete As BooleanC#
bool IsComplete { get; }Property value
Boolean
Owner property
VB.NET
ReadOnly Property Owner As StringC#
string Owner { get; }Property value
String
PercentComplete property
Fraction complete, 0.0 .. 1.0.
VB.NET
ReadOnly Property PercentComplete As DoubleC#
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 TaskStatusC#
TaskStatus Status { get; }Property value
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
Item class
Properties
| Name | Description |
|---|---|
Body | |
CreationTime | |
Kind | |
LastModificationTime | |
Message | |
MessageClass | |
Subject |
Methods
| Name | Description |
|---|---|
Wrap(PstMessage) 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). |
Details
Body property
VB.NET
Public ReadOnly Property Body As StringC#
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
Property value
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 PstMessageC#
public PstMessage Message { get; }Property value
MessageClass property
VB.NET
Public ReadOnly Property MessageClass As StringC#
public string MessageClass { get; }Property value
String
Subject property
VB.NET
Public ReadOnly Property Subject As StringC#
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 IItemC#
public static IItem Wrap(PstMessage msg);Parameters
msgPstMessage
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
ItemKind enumeration
The kind of MAPI item, derived from PidTagMessageClass.
VB.NET
Public Enum ItemKindC#
public enum ItemKindMembers
| Name | Value | Description |
|---|---|---|
Unknown | 0 | |
Mail | 1 | |
Appointment | 2 | |
Contact | 3 | |
Task | 4 | |
Note | 5 | |
Journal | 6 | |
DistributionList | 7 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
JournalItem class
VB.NET
Public NotInheritable Class JournalItem
Inherits Item
Implements IJournalItemC#
public sealed class JournalItem : Item, IJournalItemProperties
| Name | Description |
|---|---|
DurationMinutes | |
EndTime | |
JournalType | |
StartTime |
Details
DurationMinutes property
VB.NET
Public ReadOnly Property DurationMinutes As IntegerC#
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 StringC#
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
Properties
| Name | Description |
|---|---|
Attachments | |
BodyHtml | 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. |
ConversationTopic | |
DeliveryTime | |
DisplayBcc | |
DisplayCc | |
DisplayTo | |
HasAttachments | |
Importance | |
InternetMessageId | |
IsHtmlFormat | 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. |
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 StringC#
public string BodyHtml { get; }Property value
String
ConversationTopic property
VB.NET
Public ReadOnly Property ConversationTopic As StringC#
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 StringC#
public string DisplayBcc { get; }Property value
String
DisplayCc property
VB.NET
Public ReadOnly Property DisplayCc As StringC#
public string DisplayCc { get; }Property value
String
DisplayTo property
VB.NET
Public ReadOnly Property DisplayTo As StringC#
public string DisplayTo { get; }Property value
String
HasAttachments property
VB.NET
Public ReadOnly Property HasAttachments As BooleanC#
public bool HasAttachments { get; }Property value
Boolean
Importance property
VB.NET
Public ReadOnly Property Importance As ImportanceC#
public Importance Importance { get; }Property value
InternetMessageId property
VB.NET
Public ReadOnly Property InternetMessageId As StringC#
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 BooleanC#
public bool IsHtmlFormat { get; }Property value
Boolean
IsUnread property
VB.NET
Public ReadOnly Property IsUnread As BooleanC#
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 StringC#
public string SenderEmail { get; }Property value
String
SenderName property
VB.NET
Public ReadOnly Property SenderName As StringC#
public string SenderName { get; }Property value
String
Sensitivity property
VB.NET
Public ReadOnly Property Sensitivity As SensitivityC#
public Sensitivity Sensitivity { get; }Property value
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
VB.NET
Public NotInheritable Class MessageQueryC#
public sealed class MessageQueryConstructors
| Name | Description |
|---|---|
MessageQuery() |
Methods
| Name | Description |
|---|---|
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 MessageQueryC#
public MessageQuery HasClass(string prefix);Parameters
prefixString
Returns
HasMessageId(String) method
VB.NET
Public Function HasMessageId(id As String) As MessageQueryC#
public MessageQuery HasMessageId(string id);Parameters
idString
Returns
ImportanceAtLeast(Int32) method
VB.NET
Public Function ImportanceAtLeast(level As Integer) As MessageQueryC#
public MessageQuery ImportanceAtLeast(int level);Parameters
levelInt32
Returns
LargerThan(Int32) method
VB.NET
Public Function LargerThan(bytes As Integer) As MessageQueryC#
public MessageQuery LargerThan(int bytes);Parameters
bytesInt32
Returns
Matches(PstMessage) method
True when the message satisfies every criterion (empty query matches all).
VB.NET
Public Function Matches(msg As PstMessage) As BooleanC#
public bool Matches(PstMessage msg);Parameters
msgPstMessage
Returns
Boolean
OfKind(ItemKind) method
VB.NET
Public Function OfKind(kind As ItemKind) As MessageQueryC#
public MessageQuery OfKind(ItemKind kind);Parameters
kindItemKind
Returns
RecipientContains(String) method
VB.NET
Public Function RecipientContains(text As String) As MessageQueryC#
public MessageQuery RecipientContains(string text);Parameters
textString
Returns
SenderContains(String) method
VB.NET
Public Function SenderContains(text As String) As MessageQueryC#
public MessageQuery SenderContains(string text);Parameters
textString
Returns
SubjectContains(String) method
VB.NET
Public Function SubjectContains(text As String) As MessageQueryC#
public MessageQuery SubjectContains(string text);Parameters
textString
Returns
Where(Func<PstMessage, Boolean>) method
Add an arbitrary criterion.
VB.NET
Public Function Where(predicate As Func(Of PstMessage, Boolean)) As MessageQueryC#
public MessageQuery Where(Func<PstMessage, bool> predicate);Parameters
predicateFunc<PstMessage, Boolean>
Returns
WithAttachments(Boolean) method
VB.NET
Public Function WithAttachments(Optional value As Boolean = True) As MessageQueryC#
public MessageQuery WithAttachments(bool value = true);Parameters
valueBoolean
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
ModifiedOccurrence class
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 ModifiedOccurrenceC#
public sealed class ModifiedOccurrenceProperties
| Name | Description |
|---|---|
EndUtc | When the occurrence now ends (UTC). |
Location | The occurrence's own location; Nothing when it keeps the series' location. |
OriginalDate | The day the pattern put this occurrence on, at midnight: a day on the series' own calendar (in its time zone), of no Kind. |
StartUtc | When the occurrence now starts (UTC). |
Subject | The 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 DateC#
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 StringC#
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 DateC#
public DateTime OriginalDate { get; }Property value
DateTime
StartUtc property
When the occurrence now starts (UTC).
VB.NET
Public ReadOnly Property StartUtc As DateC#
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 StringC#
public string Subject { get; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
NoteItem class
Properties
| Name | Description |
|---|---|
Color | |
Height | |
Width |
Details
Color property
VB.NET
Public ReadOnly Property Color As IntegerC#
public int Color { get; }Property value
Int32
Height property
VB.NET
Public ReadOnly Property Height As IntegerC#
public int Height { get; }Property value
Int32
Width property
VB.NET
Public ReadOnly Property Width As IntegerC#
public int Width { get; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
OpenResult class
Result of PersonalStorage.TryOpen: ErrorCode 0 = opened, Store usable.
VB.NET
Public NotInheritable Class OpenResult
Inherits OperationResultC#
public sealed class OpenResult : OperationResultConstructors
| Name | Description |
|---|---|
OpenResult() |
Properties
| Name | Description |
|---|---|
Store | The 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 PersonalStorageC#
public PersonalStorage Store { get; set; }Property value
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
PersonalStorage class
An opened PST or OST file: the way in to its folders and items.
VB.NET
Public NotInheritable Class PersonalStorage
Implements IDisposableC#
public sealed class PersonalStorage : IDisposableRemarks
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
| Name | Description |
|---|---|
ChecksumErrors | 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. |
DisplayName | The store's display name (PidTagDisplayName on the message store). |
Format | |
HasPassword | 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. |
HeaderChecksumValid | 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. |
IsUnicode | |
RootFolder | The root Folder object (NID 0x122). Its subfolders include the IPM subtree. |
SourcePath | 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. |
SupportsWriting | Always False for now — this build reads but does not write. |
UnreadableFolderTables | 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. |
Views | 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. |
Methods
| Name | Description |
|---|---|
Dispose() | |
IsAnsi(String) 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. |
Open(Stream, Boolean) static | Open a PST/OST from a seekable stream. |
Open(String) static | Open a PST/OST file for reading. |
PeekFormat(String) 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. |
Search(MessageQuery) | Search the whole store for messages matching query. |
TryOpen(String) 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. |
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 IntegerC#
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 StringC#
public string DisplayName { get; }Property value
String
Format property
Property value
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 BooleanC#
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 BooleanC#
public bool HeaderChecksumValid { get; }Property value
Boolean
IsUnicode property
VB.NET
Public ReadOnly Property IsUnicode As BooleanC#
public bool IsUnicode { get; }Property value
Boolean
RootFolder property
The root Folder object (NID 0x122). Its subfolders include the IPM subtree.
Property value
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 StringC#
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 BooleanC#
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 IntegerC#
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 StoreViewsC#
public StoreViews Views { get; }Property value
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 BooleanC#
public static bool IsAnsi(string path);Parameters
pathString
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 PersonalStorageC#
public static PersonalStorage Open(Stream stm, bool leaveOpen = false);Parameters
stmStreamleaveOpenBoolean
Returns
Open(String) method static
Open a PST/OST file for reading.
VB.NET
Public Shared Function Open(path As String) As PersonalStorageC#
public static PersonalStorage Open(string path);Parameters
pathString
Returns
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 PstFormatC#
public static PstFormat PeekFormat(string path);Parameters
pathString
Returns
Search(MessageQuery) method
Search the whole store for messages matching query.
VB.NET
Public Function Search(query As MessageQuery) As IEnumerable(Of SearchHit)C#
public IEnumerable<SearchHit> Search(MessageQuery query);Parameters
queryMessageQuery
Returns
IEnumerable<SearchHit>
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 OpenResultC#
public static OpenResult TryOpen(string path);Parameters
pathString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
PstMessage class
A message or other item (contact, appointment, task, note) of an opened store.
VB.NET
Public NotInheritable Class PstMessageC#
public sealed class PstMessageRemarks
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
| Name | Description |
|---|---|
AppointmentEnd | Appointment end (PidLidAppointmentEndWhole), for calendar items. |
AppointmentStart | Appointment start (PidLidAppointmentStartWhole), for calendar items. |
Attachments | The message attachments, from the Attachment Table subnode (empty if none). |
Body | |
ContactEmail | Primary email address (PidLidEmail1EmailAddress), for contact items. |
DeliveryTime | |
HasAttachments | |
Importance | PidTagImportance (0=low, 1=normal, 2=high); 1 if unset. |
InternetMessageId | PidTagInternetMessageId. |
IsUnread | True when the message is unread (MSGFLAG_READ not set). |
Kind | |
Location | Appointment / meeting location (PidLidLocation). |
MessageClass | |
MessageFlags | PidTagMessageFlags. |
NodeId | 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. |
Recipients | The message recipients (To/Cc/Bcc), from the Recipient Table subnode. |
SenderEmail | |
SenderName | |
Size | PidTagMessageSize. |
Subject | The subject, with any stored prefix marker removed. |
SubmitTime |
Methods
| Name | Description |
|---|---|
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 StringC#
public string Body { get; }Property value
String
ContactEmail property
Primary email address (PidLidEmail1EmailAddress), for contact items.
VB.NET
Public ReadOnly Property ContactEmail As StringC#
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 BooleanC#
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 IntegerC#
public int Importance { get; }Property value
Int32
InternetMessageId property
PidTagInternetMessageId.
VB.NET
Public ReadOnly Property InternetMessageId As StringC#
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 BooleanC#
public bool IsUnread { get; }Property value
Boolean
Kind property
Property value
Location property
Appointment / meeting location (PidLidLocation).
VB.NET
Public ReadOnly Property Location As StringC#
public string Location { get; }Property value
String
MessageClass property
VB.NET
Public ReadOnly Property MessageClass As StringC#
public string MessageClass { get; }Property value
String
MessageFlags property
PidTagMessageFlags.
VB.NET
Public ReadOnly Property MessageFlags As IntegerC#
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 UIntegerC#
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 StringC#
public string SenderEmail { get; }Property value
String
SenderName property
VB.NET
Public ReadOnly Property SenderName As StringC#
public string SenderName { get; }Property value
String
Size property
PidTagMessageSize.
VB.NET
Public ReadOnly Property Size As IntegerC#
public int Size { get; }Property value
Int32
Subject property
The subject, with any stored prefix marker removed.
VB.NET
Public ReadOnly Property Subject As StringC#
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.
Returns
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 StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
Recipient class
VB.NET
Public NotInheritable Class RecipientC#
public sealed class RecipientProperties
| Name | Description |
|---|---|
Address | The best available address for display (SMTP if present, else the email address). |
AddressType | |
DisplayName | |
EmailAddress | |
RecipientType | |
SmtpAddress |
Methods
| Name | Description |
|---|---|
ToString() |
Details
Address property
The best available address for display (SMTP if present, else the email address).
VB.NET
Public ReadOnly Property Address As StringC#
public string Address { get; }Property value
String
AddressType property
VB.NET
Public ReadOnly Property AddressType As StringC#
public string AddressType { get; }Property value
String
DisplayName property
VB.NET
Public ReadOnly Property DisplayName As StringC#
public string DisplayName { get; }Property value
String
EmailAddress property
VB.NET
Public ReadOnly Property EmailAddress As StringC#
public string EmailAddress { get; }Property value
String
RecipientType property
VB.NET
Public ReadOnly Property RecipientType As RecipientTypeC#
public RecipientType RecipientType { get; }Property value
SmtpAddress property
VB.NET
Public ReadOnly Property SmtpAddress As StringC#
public string SmtpAddress { get; }Property value
String
ToString() method
VB.NET
Public Overrides Function ToString() As StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
RecipientType enumeration
PidTagRecipientType (0x0C15) — the role of a recipient on a message.
VB.NET
Public Enum RecipientTypeC#
public enum RecipientTypeMembers
| Name | Value | Description |
|---|---|---|
Originator | 0 | Original author / sender slot (0). |
To | 1 | |
Cc | 2 | |
Bcc | 3 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
RecurrenceEndKind enumeration
How a recurring series ends.
VB.NET
Public Enum RecurrenceEndKindC#
public enum RecurrenceEndKindMembers
| Name | Value | Description |
|---|---|---|
Never | 0 | It has no end. |
AfterCount | 1 | After a number of occurrences: AppointmentRecurrence.OccurrenceCount. |
OnDate | 2 | On a date: AppointmentRecurrence.EndDate. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
SearchEngine class
Walks a folder subtree applying a MessageQuery.
VB.NET
Public NotInheritable Class SearchEngineC#
public sealed class SearchEngineMethods
| Name | Description |
|---|---|
Find(PersonalStorage, MessageQuery) static | Search the whole store. |
Walk(Folder, String, MessageQuery) static | Search 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
storePersonalStoragequeryMessageQuery
Returns
IEnumerable<SearchHit>
Exceptions
| Exception | Condition |
|---|---|
ArgumentNullException | store 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
folderFolderparentPathStringqueryMessageQuery
Returns
IEnumerable<SearchHit>
Exceptions
| Exception | Condition |
|---|---|
ArgumentNullException | folder or query is Nothing. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
SearchHit class
A search result: the message and the folder path it was found in.
VB.NET
Public NotInheritable Class SearchHitC#
public sealed class SearchHitProperties
| Name | Description |
|---|---|
FolderPath | |
Message |
Details
FolderPath property
VB.NET
Public ReadOnly Property FolderPath As StringC#
public string FolderPath { get; }Property value
String
Message property
VB.NET
Public ReadOnly Property Message As PstMessageC#
public PstMessage Message { get; }Property value
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
Sensitivity enumeration
PidTagSensitivity (0x0036).
VB.NET
Public Enum SensitivityC#
public enum SensitivityMembers
| Name | Value | Description |
|---|---|---|
Normal | 0 | |
Personal | 1 | |
Private2 | 2 | |
Confidential | 3 |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
TaskItem class
Properties
| Name | Description |
|---|---|
DateCompleted | 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. |
DueDate | The day the task is due, at midnight (a calendar day, as StartDate). Nothing when the task has no due date. |
Importance | |
IsComplete | |
Owner | |
PercentComplete | |
StartDate | 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. |
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 ImportanceC#
public Importance Importance { get; }Property value
IsComplete property
VB.NET
Public ReadOnly Property IsComplete As BooleanC#
public bool IsComplete { get; }Property value
Boolean
Owner property
VB.NET
Public ReadOnly Property Owner As StringC#
public string Owner { get; }Property value
String
PercentComplete property
VB.NET
Public ReadOnly Property PercentComplete As DoubleC#
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 TaskStatusC#
public TaskStatus Status { get; }Property value
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Messaging namespace
TaskStatus enumeration
PidLidTaskStatus (PSETID_Task 0x8101).
VB.NET
Public Enum TaskStatusC#
public enum TaskStatusMembers
| Name | Value | Description |
|---|---|---|
NotStarted | 0 | |
InProgress | 1 | |
Complete | 2 | |
Waiting | 3 | |
Deferred | 4 |
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Ndb namespace
Enumerations
| Name | Description |
|---|---|
PstFormat | 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). |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Ndb namespace
PstFormat enumeration
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 PstFormatC#
public enum PstFormatMembers
| Name | Value | Description |
|---|---|---|
Unknown | 0 | Not yet determined. |
Ansi | 1 | ANSI PST — 32-bit BID/IB, 2 GB-capped legacy format (wVer 14/15). |
Unicode | 2 | Unicode PST/OST — 64-bit BID/IB (wVer >= 23). |
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Repair namespace
Classes
| Name | Description |
|---|---|
PstRepair | Rebuilds a damaged PST or OST into a new, structurally sound Unicode PST. |
RepairReport | 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. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Repair namespace
PstRepair class
Rebuilds a damaged PST or OST into a new, structurally sound Unicode PST.
VB.NET
Public NotInheritable Class PstRepairC#
public sealed class PstRepairRemarks
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
| Name | Description |
|---|---|
Repair(String, String, DiagnosticsContext, Boolean, Boolean, Int64) 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. |
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 RepairReportC#
public static RepairReport Repair(
string srcPath,
string outPath,
DiagnosticsContext diag = null,
bool overwrite = false,
bool stripPassword = false,
long maxBytes = 0
);Parameters
srcPathStringoutPathString- Where to write the repaired copy. It must not be the source file.
diagDiagnosticsContextoverwriteBooleanstripPasswordBoolean- When True, clears
PidTagPstPasswordon 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.) maxBytesInt64- Optional hard output-size cap in bytes (<= 0 = unlimited). When set, the repair fails with
OutputSizeExceededrather than writing a file that would exceed it.
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Repair namespace
RepairReport class
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 OperationResultC#
public sealed class RepairReport : OperationResultConstructors
| Name | Description |
|---|---|
RepairReport() |
Properties
| Name | Description |
|---|---|
BlocksScavenged | Data blocks recovered the same way. See NodesScavenged. |
FoldersRecreated | 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". |
FoldersRefiled | Folders that had been cut off from the folder tree and were re-attached under their original parent folder. |
FolderTablesUnreadable | Folders of the repaired output with a list (of messages or of subfolders) that could not be read back. Each is listed in Losses. |
InvalidOutputPath | 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. |
ItemsRefiled | 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. |
ItemsSampled | 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. |
ItemsUnreadable | Of ItemsSampled, how many would not open. Each is listed in Losses, and any makes the result CompletedWithLosses. |
ListEntriesRemoved | 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. |
MessagesIncomplete | 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. |
MessagesLost | 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. |
MessagesMissingFromIndex | 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. |
MessagesNotListed | 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. |
NodesScavenged | Item records recovered from intact older copies after the index pointing at them was found damaged. Good news, not a loss. |
NodesSkipped | Things other than messages that could not be read and were left out: folder objects, folder tables and other records. See also TablesLost. |
NodesWritten | |
OrphansLeftUnreachable | When RecoveryAbandoned, how many messages no folder lists were left that way. 0 when that could not be worked out. |
OrphansRecovered | Messages whose folder could not be recovered, placed in a "Lost and Found" folder. |
OutputIsValid | 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. |
OutputPath | 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. |
OutputReport | Validation of the rebuilt output. |
PagesSkipped | 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. |
PasswordStripped | True if the password property was cleared on the output. |
RecoveryAbandoned | 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. |
RecoveryNotPossible | 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. |
SourcePath | |
SourceReport | Validation of the source as supplied (Nothing if it could not be validated at all). |
SourceWasValid | |
StorePcSynthesised | 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. |
SubtreeReconnected | True when the mailbox's folder tree was reconnected to the store root (its root link had been destroyed, orphaning every folder). |
Succeeded | 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. |
TablesLost | 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. |
WrittenIntoNewStore | 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. |
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 StringC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
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 IntegerC#
public int NodesSkipped { get; set; }Property value
Int32
NodesWritten property
VB.NET
Public Property NodesWritten As IntegerC#
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 IntegerC#
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 IntegerC#
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 BooleanC#
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 StringC#
public string OutputPath { get; set; }Property value
String
OutputReport property
Validation of the rebuilt output.
VB.NET
Public Property OutputReport As ValidationReportC#
public ValidationReport OutputReport { get; set; }Property value
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 IntegerC#
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 BooleanC#
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 BooleanC#
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 BooleanC#
public bool RecoveryNotPossible { get; set; }Property value
Boolean
SourcePath property
VB.NET
Public Property SourcePath As StringC#
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 ValidationReportC#
public ValidationReport SourceReport { get; set; }Property value
SourceWasValid property
VB.NET
Public ReadOnly Property SourceWasValid As BooleanC#
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 BooleanC#
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 BooleanC#
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 BooleanC#
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 IntegerC#
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 BooleanC#
public bool WrittenIntoNewStore { get; set; }Property value
Boolean
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Validation namespace
Classes
| Name | Description |
|---|---|
HealthResult | 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. |
PstHealth | 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. |
PstValidator | |
ValidationIssue | One structural problem found by PstValidator. |
ValidationReport | 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. |
Enumerations
| Name | Description |
|---|---|
ValidationSeverity |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace
HealthResult class
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 OperationResultC#
public sealed class HealthResult : OperationResultProperties
| Name | Description |
|---|---|
ErrorCount | Structural errors found. 0 for a file that could not be examined. |
FatalError | Set when the check itself failed unexpectedly. Not a finding about the file. |
IsCorrupted | 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. |
NotChecked | What the check did not look at in a file it did examine. See ValidationReport.NotChecked. |
Path | |
Validation | 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. |
WasExamined | False when the file could not be examined; ErrorCode then says why. |
Methods
| Name | Description |
|---|---|
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 IntegerC#
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 StringC#
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 BooleanC#
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 StringC#
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 ValidationReportC#
public ValidationReport Validation { get; }Property value
WasExamined property
False when the file could not be examined; ErrorCode then says why.
VB.NET
Public ReadOnly Property WasExamined As BooleanC#
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 RepairReportC#
public RepairReport RepairTo(string outPath, DiagnosticsContext diag = null, bool overwrite = false);Parameters
outPathStringdiagDiagnosticsContextoverwriteBoolean- Replace
outPathif it exists. False by default, like every other operation that writes a file: this used to overwrite whatever was there without being asked.
Returns
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 FileOpResultC#
public FileOpResult SaveSupportReport(string outPath = null, string directory = null, string contact = null);Parameters
outPathStringdirectoryStringcontactString
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace
PstHealth class
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 PstHealthC#
public sealed class PstHealthMethods
| Name | Description |
|---|---|
Check(String, DiagnosticsContext, Boolean) 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. |
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 HealthResultC#
public static HealthResult Check(string path, DiagnosticsContext diag = null, bool stillReadable = true);Parameters
pathStringdiagDiagnosticsContextstillReadableBoolean- 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
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace
PstValidator class
VB.NET
Public NotInheritable Class PstValidatorC#
public sealed class PstValidatorMethods
| Name | Description |
|---|---|
Validate(Stream) static | Validate an already-open seekable stream (does not close it). |
Validate(Stream, DiagnosticsContext) 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. |
Validate(String) 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. |
Validate(String, DiagnosticsContext) 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. |
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 ValidationReportC#
public static ValidationReport Validate(Stream stream);Parameters
streamStream
Returns
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 ValidationReportC#
public static ValidationReport Validate(Stream stream, DiagnosticsContext diag);Parameters
streamStreamdiagDiagnosticsContext
Returns
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 ValidationReportC#
public static ValidationReport Validate(string path);Parameters
pathString
Returns
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 ValidationReportC#
public static ValidationReport Validate(string path, DiagnosticsContext diag);Parameters
pathStringdiagDiagnosticsContext
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace
ValidationIssue class
One structural problem found by PstValidator.
VB.NET
Public NotInheritable Class ValidationIssueC#
public sealed class ValidationIssueConstructors
| Name | Description |
|---|---|
ValidationIssue(ValidationSeverity, String, UInt64, String) |
Properties
| Name | Description |
|---|---|
Category | |
Message | |
Offset | |
Severity |
Methods
| Name | Description |
|---|---|
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
sevValidationSeveritycategoryStringoffsetUInt64messageString
Category property
VB.NET
Public ReadOnly Property Category As StringC#
public string Category { get; }Property value
String
Message property
VB.NET
Public ReadOnly Property Message As StringC#
public string Message { get; }Property value
String
Offset property
VB.NET
Public ReadOnly Property Offset As ULongC#
public ulong Offset { get; }Property value
UInt64
Severity property
VB.NET
Public ReadOnly Property Severity As ValidationSeverityC#
public ValidationSeverity Severity { get; }Property value
ToString() method
VB.NET
Public Overrides Function ToString() As StringC#
public override string ToString();Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace
ValidationReport class
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 ValidationReportC#
public sealed class ValidationReportConstructors
| Name | Description |
|---|---|
ValidationReport() |
Properties
| Name | Description |
|---|---|
BlocksChecked | |
ErrorCount | |
Issues | |
IsValid | 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". |
NotChecked | 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. |
NotExaminedCode | Why the file was not examined; ErrorCode.Ok when it was. |
NotExaminedReason | The reason in words, fit to show a user; empty when the file was examined. |
PagesChecked | |
WarningCount | |
WasExamined | 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. |
Details
ValidationReport() constructor
VB.NET
Public Sub New()C#
public ValidationReport();BlocksChecked property
VB.NET
Public Property BlocksChecked As IntegerC#
public int BlocksChecked { get; set; }Property value
Int32
ErrorCount property
VB.NET
Public ReadOnly Property ErrorCount As IntegerC#
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 BooleanC#
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 ErrorCodeC#
public ErrorCode NotExaminedCode { get; }Property value
NotExaminedReason property
The reason in words, fit to show a user; empty when the file was examined.
VB.NET
Public ReadOnly Property NotExaminedReason As StringC#
public string NotExaminedReason { get; }Property value
String
PagesChecked property
VB.NET
Public Property PagesChecked As IntegerC#
public int PagesChecked { get; set; }Property value
Int32
WarningCount property
VB.NET
Public ReadOnly Property WarningCount As IntegerC#
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 BooleanC#
public bool WasExamined { get; }Property value
Boolean
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Validation namespace
ValidationSeverity enumeration
VB.NET
Public Enum ValidationSeverityC#
public enum ValidationSeverityMembers
| Name | Value | Description |
|---|---|---|
Error | 0 | |
Warning | 1 |
Bastion PST SDK 3.0.0 › API reference
Bastion.Pst.Views namespace
Classes
| Name | Description |
|---|---|
AppointmentView | An appointment as a calendar shows it. |
AttachmentBytesResult | The bytes of one attachment, with the standard error contract (StoreViews.TryAttachmentBytes). |
AttachmentView | One attachment, as a reading pane lists it. |
ContactMerger | |
ContactView | A contact as a card view shows it. |
ItemDetail | The full detail of one item, for a reading pane or an item window. |
ItemOps | |
ItemQuery | |
ItemQuery.RowFacts | What the contents table can tell us about a row without opening it. |
ItemViewBase | Fields shared by every kind of item. |
JournalView | A journal entry: a record of a telephone call, a meeting, a document worked on. |
MailView | A message as a mail list shows it. |
NoteView | A sticky note. |
RssView | 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. |
SaveReport | What a save/export produced: the standard error contract plus the files written. |
SectionFolder | A folder belonging to a section — a calendar, a contact folder — for a host to list. |
StoreViews | |
TaskView | A task as a to-do list shows it. |
Enumerations
| Name | Description |
|---|---|
SaveFormat | The file an item is saved as when the user picks "Save As" with no format chosen. |
Section | The sections of a mailbox. |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
AppointmentView class
An appointment as a calendar shows it.
VB.NET
Public NotInheritable Class AppointmentView
Inherits ItemViewBaseC#
public sealed class AppointmentView : ItemViewBaseConstructors
| Name | Description |
|---|---|
AppointmentView() |
Properties
| Name | Description |
|---|---|
Attendees | |
Body | |
BusyStatus | |
Display | |
EndTime | When the appointment ends (the first occurrence, for a recurring one): an instant, in UTC. |
IsAllDay | |
IsRecurring | True for a series: StartTime and EndTime are then those of its first occurrence only. |
Location | |
OccurrenceKey | Identity for spotting the same appointment archived twice: same subject, same start, same length. Used when merging calendars of the same name. |
Organiser | |
ReminderSet | |
StartTime | 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. |
Subject |
Details
AppointmentView() constructor
VB.NET
Public Sub New()C#
public AppointmentView();Attendees property
VB.NET
Public Property Attendees As StringC#
public string Attendees { get; set; }Property value
String
Body property
VB.NET
Public Property Body As StringC#
public string Body { get; set; }Property value
String
BusyStatus property
VB.NET
Public Property BusyStatus As BusyStatusC#
public BusyStatus BusyStatus { get; set; }Property value
Display property
VB.NET
Public Overrides ReadOnly Property Display As StringC#
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 BooleanC#
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 BooleanC#
public bool IsRecurring { get; set; }Property value
Boolean
Location property
VB.NET
Public Property Location As StringC#
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 StringC#
public string OccurrenceKey { get; }Property value
String
Organiser property
VB.NET
Public Property Organiser As StringC#
public string Organiser { get; set; }Property value
String
ReminderSet property
VB.NET
Public Property ReminderSet As BooleanC#
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 StringC#
public string Subject { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
AttachmentBytesResult class
The bytes of one attachment, with the standard error contract (StoreViews.TryAttachmentBytes).
VB.NET
Public NotInheritable Class AttachmentBytesResult
Inherits OperationResultC#
public sealed class AttachmentBytesResult : OperationResultConstructors
| Name | Description |
|---|---|
AttachmentBytesResult() |
Properties
| Name | Description |
|---|---|
Bytes | The 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
One attachment, as a reading pane lists it.
VB.NET
Public NotInheritable Class AttachmentViewC#
public sealed class AttachmentViewConstructors
| Name | Description |
|---|---|
AttachmentView() |
Properties
| Name | Description |
|---|---|
ContentId | |
FileName | |
Index | |
IsEmbeddedMessage | |
IsInline | 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. |
MimeTag | |
SizeBytes |
Details
AttachmentView() constructor
VB.NET
Public Sub New()C#
public AttachmentView();ContentId property
VB.NET
Public Property ContentId As StringC#
public string ContentId { get; set; }Property value
String
FileName property
VB.NET
Public Property FileName As StringC#
public string FileName { get; set; }Property value
String
Index property
VB.NET
Public Property Index As IntegerC#
public int Index { get; set; }Property value
Int32
IsEmbeddedMessage property
VB.NET
Public Property IsEmbeddedMessage As BooleanC#
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 BooleanC#
public bool IsInline { get; set; }Property value
Boolean
MimeTag property
VB.NET
Public Property MimeTag As StringC#
public string MimeTag { get; set; }Property value
String
SizeBytes property
VB.NET
Public Property SizeBytes As IntegerC#
public int SizeBytes { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ContactMerger class
VB.NET
Public NotInheritable Class ContactMergerC#
public sealed class ContactMergerMethods
| Name | Description |
|---|---|
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 ( As with |
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
rowsIEnumerable<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
rowsIEnumerable<ContactView>
Returns
List<ContactView>
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ContactView class
A contact as a card view shows it.
VB.NET
Public NotInheritable Class ContactView
Inherits ItemViewBaseC#
public sealed class ContactView : ItemViewBaseConstructors
| Name | Description |
|---|---|
ContactView() |
Properties
| Name | Description |
|---|---|
AllEmails | Every e-mail address on the contact, primary first, blanks removed. |
AlternateAddresses | Postal addresses that differed between the entries ContactMerger combined: the first is in BusinessAddress or HomeAddress, the others are here. |
AlternateDetails | 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. |
AlternateEmails | |
AlternatePhones | |
AlternatePhotos | Photos, other than Photo, that the combined entries carried. |
Anniversary | |
Birthday | |
BusinessAddress | |
BusinessFax | |
BusinessPhone | |
Company | |
Department | |
Display | |
Email | The address to show when there is room for one. |
Email1 | |
Email2 | |
Email3 | |
FileUnder | |
FullName | |
GivenName | |
HomeAddress | |
HomePhone | |
IsDistributionList | 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. |
JobTitle | |
MemberNames | The members as one line, for a card that has room for a line and not a list. |
Members | Members of the group, when IsDistributionList is set. |
MembershipSummary | 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. |
MergedFrom | |
MergedFromMemberCount | Member count as the list itself reported it, used when the members could not be decoded but the count could. |
MobilePhone | |
Notes | |
Phone | The number to show when there is room for one: business, then mobile, then home — the order Outlook prefers on a card. |
Photo | The contact's photo (JPEG/PNG bytes) if the card carries one, else Nothing. |
SortKey | Surname-first key Outlook files contacts under. A group has no surname, so it files under its own name. |
SourceFolders | |
Surname | |
WebPage |
Methods
| Name | Description |
|---|---|
Clone() | An independent copy of this row.
The lists are new lists over the same strings, so appending to a copy's |
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 StringC#
public string BusinessAddress { get; set; }Property value
String
BusinessFax property
VB.NET
Public Property BusinessFax As StringC#
public string BusinessFax { get; set; }Property value
String
BusinessPhone property
VB.NET
Public Property BusinessPhone As StringC#
public string BusinessPhone { get; set; }Property value
String
Company property
VB.NET
Public Property Company As StringC#
public string Company { get; set; }Property value
String
Department property
VB.NET
Public Property Department As StringC#
public string Department { get; set; }Property value
String
Display property
VB.NET
Public Overrides ReadOnly Property Display As StringC#
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 StringC#
public string Email { get; }Property value
String
Email1 property
VB.NET
Public Property Email1 As StringC#
public string Email1 { get; set; }Property value
String
Email2 property
VB.NET
Public Property Email2 As StringC#
public string Email2 { get; set; }Property value
String
Email3 property
VB.NET
Public Property Email3 As StringC#
public string Email3 { get; set; }Property value
String
FileUnder property
VB.NET
Public Property FileUnder As StringC#
public string FileUnder { get; set; }Property value
String
FullName property
VB.NET
Public Property FullName As StringC#
public string FullName { get; set; }Property value
String
GivenName property
VB.NET
Public Property GivenName As StringC#
public string GivenName { get; set; }Property value
String
HomeAddress property
VB.NET
Public Property HomeAddress As StringC#
public string HomeAddress { get; set; }Property value
String
HomePhone property
VB.NET
Public Property HomePhone As StringC#
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 BooleanC#
public bool IsDistributionList { get; set; }Property value
Boolean
JobTitle property
VB.NET
Public Property JobTitle As StringC#
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 StringC#
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 StringC#
public string MembershipSummary { get; }Property value
String
MergedFrom property
VB.NET
Public Property MergedFrom As IntegerC#
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 IntegerC#
public int MergedFromMemberCount { get; set; }Property value
Int32
MobilePhone property
VB.NET
Public Property MobilePhone As StringC#
public string MobilePhone { get; set; }Property value
String
Notes property
VB.NET
Public Property Notes As StringC#
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 StringC#
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 StringC#
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 StringC#
public string Surname { get; set; }Property value
String
WebPage property
VB.NET
Public Property WebPage As StringC#
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 ContactViewC#
public ContactView Clone();Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ItemDetail class
The full detail of one item, for a reading pane or an item window.
VB.NET
Public NotInheritable Class ItemDetailC#
public sealed class ItemDetailConstructors
| Name | Description |
|---|---|
ItemDetail() |
Properties
| Name | Description |
|---|---|
Attachments | |
BodyHtml | The HTML body, or "" when the message has none. |
BodyPlain | 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. |
Date | |
DisplayBcc | |
DisplayCc | |
DisplayTo | |
Error | 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. |
HasHtml | 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. |
IsHtmlFormat | The same fact said the way an e-mail object says it: this message is HTML format. |
Kind | |
MessageClass | |
Nid | |
Recipients | |
SenderEmail | |
SenderName | |
Subject | |
Unreadable | 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. |
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 StringC#
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 StringC#
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 StringC#
public string DisplayBcc { get; set; }Property value
String
DisplayCc property
VB.NET
Public Property DisplayCc As StringC#
public string DisplayCc { get; set; }Property value
String
DisplayTo property
VB.NET
Public Property DisplayTo As StringC#
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 StringC#
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 BooleanC#
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 BooleanC#
public bool IsHtmlFormat { get; }Property value
Boolean
Kind property
Property value
MessageClass property
VB.NET
Public Property MessageClass As StringC#
public string MessageClass { get; set; }Property value
String
Nid property
VB.NET
Public Property Nid As UIntegerC#
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 StringC#
public string SenderEmail { get; set; }Property value
String
SenderName property
VB.NET
Public Property SenderName As StringC#
public string SenderName { get; set; }Property value
String
Subject property
VB.NET
Public Property Subject As StringC#
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 BooleanC#
public bool Unreadable { get; set; }Property value
Boolean
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ItemOps class
VB.NET
Public NotInheritable Class ItemOpsC#
public sealed class ItemOpsMethods
| Name | Description |
|---|---|
CopyItems(String, String, IEnumerable<UInt32>, String, String, String, DiagnosticsContext) 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. |
DeleteItems(String, String, String, ISet<UInt32>, DiagnosticsContext) static | Delete items from a folder, writing the result to outPath. |
ImportFiles(String, String, String, IEnumerable<String>, DiagnosticsContext) 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). |
IsWritable(String) static | |
MoveItems(String, String, String, String, ISet<UInt32>, DiagnosticsContext) static | Move items between folders of the same store. |
SaveItems(String, String, IEnumerable<UInt32>, String, SaveFormat, CancellationToken, Action<Int32>) 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. |
WhyNotWritable(String) static | Why 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 EditReportC#
public static EditReport CopyItems(
string sourcePath,
string sourceFolderPath,
IEnumerable<uint> nids,
string targetPath,
string targetOutPath,
string targetFolderPath,
DiagnosticsContext diag
);Parameters
sourcePathStringsourceFolderPathStringnidsIEnumerable<UInt32>targetPathStringtargetOutPathStringtargetFolderPathStringdiagDiagnosticsContext
Returns
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 EditReportC#
public static EditReport DeleteItems(
string storePath,
string outPath,
string folderPath,
ISet<uint> nids,
DiagnosticsContext diag
);Parameters
storePathStringoutPathStringfolderPathStringnidsISet<UInt32>diagDiagnosticsContext
Returns
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 EditReportC#
public static EditReport ImportFiles(
string storePath,
string outPath,
string folderPath,
IEnumerable<string> files,
DiagnosticsContext diag
);Parameters
storePathStringoutPathStringfolderPathStringfilesIEnumerable<String>diagDiagnosticsContext
Returns
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 BooleanC#
public static bool IsWritable(string storePath);Parameters
storePathString
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 EditReportC#
public static EditReport MoveItems(
string storePath,
string outPath,
string fromFolderPath,
string toFolderPath,
ISet<uint> nids,
DiagnosticsContext diag
);Parameters
storePathStringoutPathStringfromFolderPathStringtoFolderPathStringnidsISet<UInt32>diagDiagnosticsContext
Returns
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 SaveReportC#
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
storePathStringfolderPathStringnidsIEnumerable<UInt32>targetDirStringformatSaveFormatcancelCancellationTokenprogressAction<Int32>
Returns
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 StringC#
public static string WhyNotWritable(string storePath);Parameters
storePathString
Returns
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ItemQuery class
VB.NET
Public NotInheritable Class ItemQueryC#
public sealed class ItemQueryConstructors
| Name | Description |
|---|---|
ItemQuery() |
Methods
| Name | Description |
|---|---|
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 ItemQueryC#
public ItemQuery BodyContains(string text);Parameters
textString
Returns
DateBefore(DateTime) method
Item dated before until. Cheap.
VB.NET
Public Function DateBefore(until As Date) As ItemQueryC#
public ItemQuery DateBefore(DateTime until);Parameters
untilDateTime
Returns
DateFrom(DateTime) method
Item dated on or after from. Cheap.
VB.NET
Public Function DateFrom(from As Date) As ItemQueryC#
public ItemQuery DateFrom(DateTime from);Parameters
fromDateTime
Returns
HasClass(String) method
Message class starts with prefix ("IPM.Contact"). Cheap.
VB.NET
Public Function HasClass(prefix As String) As ItemQueryC#
public ItemQuery HasClass(string prefix);Parameters
prefixString
Returns
InFolder(String) method
Only look in this folder path (exact, case-insensitive).
VB.NET
Public Function InFolder(path As String) As ItemQueryC#
public ItemQuery InFolder(string path);Parameters
pathString
Returns
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 ItemQueryC#
public ItemQuery InFolders(Func<string, bool> predicate);Parameters
predicateFunc<String, Boolean>
Returns
LargerThan(Int32) method
Item is larger than bytes. Cheap.
VB.NET
Public Function LargerThan(bytes As Integer) As ItemQueryC#
public ItemQuery LargerThan(int bytes);Parameters
bytesInt32
Returns
SenderContains(String) method
Sender name or address contains text. Cheap.
VB.NET
Public Function SenderContains(text As String) As ItemQueryC#
public ItemQuery SenderContains(string text);Parameters
textString
Returns
SubjectContains(String) method
Subject contains text. Cheap — read from the table row.
VB.NET
Public Function SubjectContains(text As String) As ItemQueryC#
public ItemQuery SubjectContains(string text);Parameters
textString
Returns
Take(Int32) method
Stop after n matches (0 = no limit).
Parameters
nInt32
Returns
TextContains(String) method
Subject OR sender contains text — what a search box means. Cheap.
VB.NET
Public Function TextContains(text As String) As ItemQueryC#
public ItemQuery TextContains(string text);Parameters
textString
Returns
Unread() method
Unread only. Cheap.
Returns
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 ItemQueryC#
public ItemQuery Where(Func<PstMessage, bool> predicate);Parameters
predicateFunc<PstMessage, Boolean>
Returns
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ItemQuery.RowFacts class
What the contents table can tell us about a row without opening it.
VB.NET
Public NotInheritable Class RowFactsC#
public sealed class RowFactsConstructors
| Name | Description |
|---|---|
RowFacts() |
Properties
| Name | Description |
|---|---|
Date | |
DisplayTo | Who the message was addressed to — what a Sent Items list shows. |
HasAttachments | |
Importance | PidTagImportance (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 StringC#
public string DisplayTo { get; set; }Property value
String
HasAttachments property
VB.NET
Public Property HasAttachments As BooleanC#
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 IntegerC#
public int Importance { get; set; }Property value
Int32
IsUnread property
VB.NET
Public Property IsUnread As BooleanC#
public bool IsUnread { get; set; }Property value
Boolean
MessageClass property
VB.NET
Public Property MessageClass As StringC#
public string MessageClass { get; set; }Property value
String
Nid property
VB.NET
Public Property Nid As UIntegerC#
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 StringC#
public string SenderEmail { get; set; }Property value
String
SenderName property
VB.NET
Public Property SenderName As StringC#
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 IntegerC#
public int Size { get; set; }Property value
Int32
Subject property
VB.NET
Public Property Subject As StringC#
public string Subject { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
ItemViewBase class
Fields shared by every kind of item.
VB.NET
Public MustInherit Class ItemViewBaseC#
public abstract class ItemViewBaseProperties
| Name | Description |
|---|---|
Display | What a list shows when it has one line to spare. |
FolderName | Display name of the folder holding the item ("Inbox"). |
FolderNid | Node id of that folder — lets a host act on the item without re-walking the tree. |
FolderPath | Full path of the folder holding the item ("Top of Outlook data file\Inbox"). |
Kind | |
MessageClass | |
Nid | Node id of the item within its store — the handle for reopening it. |
ReadError | 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. |
Size | |
StorePath | File 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 StringC#
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 StringC#
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 UIntegerC#
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 StringC#
public string FolderPath { get; set; }Property value
String
Kind property
Property value
MessageClass property
VB.NET
Public Property MessageClass As StringC#
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 UIntegerC#
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 StringC#
public string ReadError { get; set; }Property value
String
Size property
VB.NET
Public Property Size As IntegerC#
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 StringC#
public string StorePath { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
JournalView class
A journal entry: a record of a telephone call, a meeting, a document worked on.
VB.NET
Public NotInheritable Class JournalView
Inherits ItemViewBaseC#
public sealed class JournalView : ItemViewBaseConstructors
| Name | Description |
|---|---|
JournalView() |
Properties
| Name | Description |
|---|---|
Body | The entry's notes, as plain text. |
Display | The line a list shows for the entry: its subject, or "(no subject)". |
DurationMinutes | How long the activity lasted, in minutes, as the entry records it. |
EndTime | When the activity ended, or Nothing when the entry does not say. |
EntryType | What kind of entry it is, as Outlook names it ("Phone call", "Meeting"). |
StartTime | When the activity began, or Nothing when the entry does not say. |
Subject | The 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 StringC#
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 StringC#
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 IntegerC#
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 StringC#
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 StringC#
public string Subject { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
MailView class
A message as a mail list shows it.
VB.NET
Public NotInheritable Class MailView
Inherits ItemViewBaseC#
public sealed class MailView : ItemViewBaseConstructors
| Name | Description |
|---|---|
MailView() |
Properties
| Name | Description |
|---|---|
Date | Received if known, else sent — what Outlook sorts a mail list by. |
Display | |
FromDisplay | Who the row is from: the sender's name, their address if unnamed. |
HasAttachments | |
Importance | |
IsHtmlFormat | True when the message was written as HTML and should be rendered as HTML. |
IsUnread | |
Preview | First line or so of the body, for the second/third line of a message list. |
Received | |
SenderEmail | |
SenderName | |
Sent | |
SizeBytes | Size 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 StringC#
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 StringC#
public string FromDisplay { get; }Property value
String
HasAttachments property
VB.NET
Public Property HasAttachments As BooleanC#
public bool HasAttachments { get; set; }Property value
Boolean
Importance property
VB.NET
Public Property Importance As IntegerC#
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 BooleanC#
public bool IsHtmlFormat { get; set; }Property value
Boolean
IsUnread property
VB.NET
Public Property IsUnread As BooleanC#
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 StringC#
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 StringC#
public string SenderEmail { get; set; }Property value
String
SenderName property
VB.NET
Public Property SenderName As StringC#
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 IntegerC#
public int SizeBytes { get; }Property value
Int32
Subject property
VB.NET
Public Property Subject As StringC#
public string Subject { get; set; }Property value
String
To property
VB.NET
Public Property To As StringC#
public string To { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
NoteView class
A sticky note.
VB.NET
Public NotInheritable Class NoteView
Inherits ItemViewBaseC#
public sealed class NoteView : ItemViewBaseConstructors
| Name | Description |
|---|---|
NoteView() |
Properties
| Name | Description |
|---|---|
Body | |
Colour | |
Created | |
Display | |
Subject |
Details
NoteView() constructor
VB.NET
Public Sub New()C#
public NoteView();Body property
VB.NET
Public Property Body As StringC#
public string Body { get; set; }Property value
String
Colour property
VB.NET
Public Property Colour As IntegerC#
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 StringC#
public override string Display { get; }Property value
String
Subject property
VB.NET
Public Property Subject As StringC#
public string Subject { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
RssView class
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 ItemViewBaseC#
public sealed class RssView : ItemViewBaseConstructors
| Name | Description |
|---|---|
RssView() |
Properties
| Name | Description |
|---|---|
Author | |
Display | |
FeedName | The feed the post came from - normally the folder it is filed in. |
IsHtmlFormat | |
Link | Link 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 StringC#
public string Author { get; set; }Property value
String
Display property
VB.NET
Public Overrides ReadOnly Property Display As StringC#
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 StringC#
public string FeedName { get; set; }Property value
String
IsHtmlFormat property
VB.NET
Public Property IsHtmlFormat As BooleanC#
public bool IsHtmlFormat { get; set; }Property value
Boolean
Link property
Link back to the original article, when the post carries one.
VB.NET
Public Property Link As StringC#
public string Link { get; set; }Property value
String
Preview property
VB.NET
Public Property Preview As StringC#
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 StringC#
public string Subject { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
SaveFormat enumeration
The file an item is saved as when the user picks "Save As" with no format chosen.
VB.NET
Public Enum SaveFormatC#
public enum SaveFormatMembers
| Name | Value | Description |
|---|---|---|
Native | 0 | Pick by item kind: mail/.msg, contact/.vcf, appointment/.ics, note/.txt. |
Msg | 1 | Outlook item file (.msg) — every property of the item, for every kind. |
Vcf | 2 | vCard (.vcf) — contacts, for any address book. |
Ics | 3 | iCalendar (.ics) — appointments, for any calendar. |
Txt | 4 | Plain text (.txt). |
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
SaveReport class
What a save/export produced: the standard error contract plus the files written.
VB.NET
Public NotInheritable Class SaveReport
Inherits OperationResultC#
public sealed class SaveReport : OperationResultRemarks
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
| Name | Description |
|---|---|
SaveReport() |
Properties
| Name | Description |
|---|---|
Error | 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. |
Failed | Items that could not be saved. Each is a record in OperationResult.Losses, with the reason. |
Files | The files written, in the order they were saved. |
Ok | 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. |
Saved | Items saved. |
Skipped | 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. |
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 StringC#
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 IntegerC#
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 BooleanC#
public bool Ok { get; }Property value
Boolean
Saved property
Items saved.
VB.NET
Public Property Saved As IntegerC#
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 IntegerC#
public int Skipped { get; set; }Property value
Int32
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
Section enumeration
The sections of a mailbox.
VB.NET
Public Enum SectionC#
public enum SectionMembers
| Name | Value | Description |
|---|---|---|
Mail | 0 | |
Calendar | 1 | |
Contacts | 2 | |
Tasks | 3 | |
Notes | 4 | |
Journal | 5 | |
Rss | 6 | Subscribed 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
A folder belonging to a section — a calendar, a contact folder — for a host to list.
VB.NET
Public NotInheritable Class SectionFolderC#
public sealed class SectionFolderConstructors
| Name | Description |
|---|---|
SectionFolder() |
Properties
| Name | Description |
|---|---|
FullPath | |
ItemCount | |
Name | |
Nid | |
StorePath |
Details
SectionFolder() constructor
VB.NET
Public Sub New()C#
public SectionFolder();FullPath property
VB.NET
Public Property FullPath As StringC#
public string FullPath { get; set; }Property value
String
ItemCount property
VB.NET
Public Property ItemCount As IntegerC#
public int ItemCount { get; set; }Property value
Int32
Name property
VB.NET
Public Property Name As StringC#
public string Name { get; set; }Property value
String
Nid property
VB.NET
Public Property Nid As UIntegerC#
public uint Nid { get; set; }Property value
UInt32
StorePath property
VB.NET
Public Property StorePath As StringC#
public string StorePath { get; set; }Property value
String
Bastion PST SDK 3.0.0 › API reference › Bastion.Pst.Views namespace
StoreViews class
VB.NET
Public NotInheritable Class StoreViewsC#
public sealed class StoreViewsProperties
| Name | Description |
|---|---|
EmptyEmailPlaceholder 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. |
FoldersUnreadable | 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. |
HiddenFolderNames 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. |
IncludeHiddenFolders | Include Outlook's hidden address-book folders in contact views (default False). |
RowsWithReadErrors | 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. |
Methods
| Name | Description |
|---|---|
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 StringC#
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 IntegerC#
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 BooleanC#
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 IntegerC#
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
queryItemQuery
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
folderFoldernidUInt32indexInt32
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
queryItemQuery
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 ItemDetailC#
public ItemDetail Detail(Folder folder, uint nid);Parameters
folderFoldernidUInt32
Returns
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
queryItemQuery
Returns
IEnumerable<JournalView>
Mail(ItemQuery) method
Every mail item in the store.
Parameters
queryItemQuery
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.
Parameters
Returns
IEnumerable<MailView>
Notes(ItemQuery) method
Every note in the store.
Parameters
queryItemQuery
Returns
IEnumerable<NoteView>
Rss(ItemQuery) method
Every RSS post in the store.
Parameters
queryItemQuery
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
sectionSection
Returns
List<SectionFolder>
Tasks(ItemQuery) method
Every task in the store.
Parameters
queryItemQuery
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 AttachmentBytesResultC#
public AttachmentBytesResult TryAttachmentBytes(Folder folder, uint nid, int index);Parameters
folderFoldernidUInt32indexInt32
Returns
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
A task as a to-do list shows it.
VB.NET
Public NotInheritable Class TaskView
Inherits ItemViewBaseC#
public sealed class TaskView : ItemViewBaseConstructors
| Name | Description |
|---|---|
TaskView() |
Properties
| Name | Description |
|---|---|
Body | |
DateCompleted | The day the task was completed: a calendar day, as StartDate. |
Display | |
DueDate | The day the task is due: a calendar day, as StartDate. |
Importance | |
IsComplete | |
IsOverdue | |
Owner | |
PercentComplete | |
StartDate | 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. |
Status | |
StatusText | |
Subject |
Details
TaskView() constructor
VB.NET
Public Sub New()C#
public TaskView();Body property
VB.NET
Public Property Body As StringC#
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 StringC#
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 ImportanceC#
public Importance Importance { get; set; }Property value
IsComplete property
VB.NET
Public Property IsComplete As BooleanC#
public bool IsComplete { get; set; }Property value
Boolean
IsOverdue property
VB.NET
Public ReadOnly Property IsOverdue As BooleanC#
public bool IsOverdue { get; }Property value
Boolean
Owner property
VB.NET
Public Property Owner As StringC#
public string Owner { get; set; }Property value
String
PercentComplete property
VB.NET
Public Property PercentComplete As DoubleC#
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 TaskStatusC#
public TaskStatus Status { get; set; }Property value
StatusText property
VB.NET
Public Property StatusText As StringC#
public string StatusText { get; set; }Property value
String
Subject property
VB.NET
Public Property Subject As StringC#
public string Subject { get; set; }Property value
String