v0.1.0¶
Released: 2025-05-12
Overview¶
Initial release of outlook-pst-go with full read and write support for Microsoft Outlook PST files.
Features¶
Reading PST Files¶
- Open and read PST and OST files
- Support for both ANSI (32-bit) and Unicode (64-bit) formats
- Support for all encryption methods (none, permute, cyclic)
- Navigate folder hierarchy
- Read messages with full property access
- Access attachments and embedded messages
- Iterate recipients (To, Cc, Bcc)
- Access named properties
- Search folder support
Writing PST Files¶
- Create new PST files from scratch
- Transaction-based write operations with two-phase commit
- Create and manage folder hierarchies
- Create messages with:
- Subject, body (plain text, HTML, RTF)
- Sender information
- Recipients (To, Cc, Bcc)
- Attachments with MIME type support
- Custom properties
- Modify existing content:
- Delete messages and folders
- Move and copy messages between folders
- Update message properties (mark as read/unread)
- Compact PST files to reclaim space
Architecture¶
Four-layer architecture matching the MS-PST specification:
| Layer | Purpose |
|---|---|
| Messaging | High-level API (PST, Folder, Message, Attachment) |
| LTP | Logical layer (Heap, BTH, PropertyBag, Table) |
| NDB | Node Database (Database, Node, Block, B-trees) |
| Disk | Binary format (Headers, Pages, Blocks, Encryption) |
Command-Line Tool¶
The pstinfo command displays information about PST files:
go install github.com/grokify/outlook-pst-go/cmd/pstinfo@latest
pstinfo archive.pst
pstinfo -messages archive.pst
pstinfo -messages -attachments archive.pst
API Highlights¶
Reading¶
pst, err := outlookpst.Open("archive.pst")
defer pst.Close()
root, _ := pst.RootFolder()
for folder, _ := range root.Subfolders() {
for msg, _ := range folder.Messages() {
subject, _ := msg.Subject()
fmt.Println(subject)
}
}
Writing¶
pst, err := outlookpst.Create("new.pst", disk.FormatUnicode)
defer pst.Close()
ctx, _ := pst.BeginWrite()
root, _ := pst.RootFolder()
inbox, _ := ctx.CreateFolder(root, "Inbox")
ctx.CreateMessage(inbox).
SetSubject("Hello").
SetBody("World").
Build()
ctx.Commit()
Supported Formats¶
| Format | Version | Read | Write |
|---|---|---|---|
| ANSI PST | 14-15 | Yes | Yes |
| Unicode PST | 20-23 | Yes | Yes |
| OST | Any | Yes | No |
Dependencies¶
- Go 1.23 or later (for iterator support)
- No CGO dependencies
Known Limitations¶
- Password-encrypted PST files are not supported
- RTF body compression is not decompressed
- OST files are read-only
References¶
- [MS-PST]: Outlook Personal Folders (.pst) File Format
- [MS-OXPROPS]: Exchange Server Protocols Master Property List