OabFile Class
An offline address book of Exchange and Outlook in the version 4 Full Details format ([MS-OXOAB] 2.9): the file udetails.oab Outlook keeps in its Offline Address Books folder. It has the schemas of its records, the header record that describes the address list, and a record per Address Book object.
public sealed class OabFileExample
var book = OabFile.Create();
book.Header.Values[MapiPropertyTag.FromValue(0x6800001F)] = "\\Global Address List";
book.Header.Values[MapiPropertyTag.FromValue(0x68010003)] = 1;
var record = new OabRecord();
record.Values[MapiPropertyTag.FromValue(0x3003001E)] = "/o=Example/ou=Exchange Administrative Group/cn=Recipients/cn=alice";
record.Values[MapiPropertyTag.FromValue(0x39FE001F)] = "alice@example.com";
record.Values[MapiPropertyTag.FromValue(0x3001001F)] = "Alice Martin";
record.Values[MapiPropertyTag.FromValue(0x800F101F)] = new[] { "SMTP:alice@example.com", "smtp:a.martin@example.com" };
record.Values[MapiPropertyTag.FromValue(0x0FFE0003)] = 6;
book.Records.Add(record);
book.Save(path);
var file = OabFile.Load(path);
Assert.Equal("\\Global Address List", file.Name);
var alice = file.Records.Single();
Assert.Equal("alice@example.com", alice.SmtpAddress);
Assert.Equal(["SMTP:alice@example.com", "smtp:a.martin@example.com"], alice.ProxyAddresses);
// A record as a vCard, or as a contact of Outlook
var card = VCard.FromOab(alice);
Assert.Equal("Alice Martin", card.FormattedName);Constructors
| Name | Description |
|---|---|
| OabFile() |
OabFile()
OabFile.cspublic OabFile()No documentation is available.
Properties
| Name | Description |
|---|---|
| Checksum | Gets the checksum of the file, as read (ulSerial): the CRC of the file after its header. |
| Header | Gets the header record: the name of the address list (0x6800001F), its distinguished name (0x6804001E), its sequence number (0x68010003) and its GUID (0x6802001E). |
| HeaderProperties | Gets the properties the header record can have (rgHdrAtts). |
| Name | Gets the name of the address list (PidTagOfflineAddressBookName). |
| RecordProperties | Gets the properties the records can have (rgOabAtts), in their order in the records. |
| Records | Gets the records of the Address Book objects. |
| Sequence | Gets the sequence number of the address book (PidTagOfflineAddressBookSequence), which increases with each generation. |
Checksum
OabFile.csHeader
OabFile.csHeaderProperties
OabFile.csGets the properties the header record can have (rgHdrAtts).
public IList<OabPropertyDefinition> HeaderProperties { get; }Property value
Name
OabFile.csRecordProperties
OabFile.csGets the properties the records can have (rgOabAtts), in their order in the records.
public IList<OabPropertyDefinition> RecordProperties { get; }Property value
Records
OabFile.csGets the records of the Address Book objects.
Property value
Sequence
OabFile.csMethods
| Name | Description |
|---|---|
| Create() | Creates an address book with the properties the specification requires in the header record and in the records. |
| Load(Stream, bool) | Reads an address book from a stream, until its end. |
| Load(ReadOnlySpan<byte>, bool) | Reads an address book. |
| Load(string, bool) | Reads an address book, such as udetails.oab. |
| Save(Stream) | Writes the address book, with its checksum. The values of the records must have the types of their properties; the empty strings and binaries are not written, as the specification requires. |
| Save(string) | Writes the address book in a file. |
| ToByteArray() | Returns the content of the file. |
Create()
OabFile.csLoad overloads
Load(Stream, bool)
OabFile.csReads an address book from a stream, until its end.
Parameters
Returns
OabFile The address book.
Exceptions
InvalidEmailDataException- The file is not an uncompressed version 4 Full Details file, its structures are malformed, or its checksum is invalid.
Load(ReadOnlySpan<byte>, bool)
OabFile.csReads an address book.
public static OabFile Load(ReadOnlySpan<byte> data, bool verifyChecksum = true)Parameters
dataReadOnlySpan<byte>- The content of the file.
verifyChecksumbooltrueto check the checksum of the file.
Returns
OabFile The address book.
Exceptions
InvalidEmailDataException- The file is not an uncompressed version 4 Full Details file, its structures are malformed, or its checksum is invalid.
Load(string, bool)
OabFile.csReads an address book, such as udetails.oab.
Parameters
Returns
OabFile The address book.
Exceptions
InvalidEmailDataException- The file is not an uncompressed version 4 Full Details file, its structures are malformed, or its checksum is invalid.
Save overloads
Save(Stream)
OabFile.csWrites the address book, with its checksum. The values of the records must have the types of their properties; the empty strings and binaries are not written, as the specification requires.
Parameters
streamStream- The stream.
Exceptions
InvalidOperationException- A value does not have the type of its property.
Save(string)
OabFile.csWrites the address book in a file.
Parameters
pathstring- The path of the file.
Exceptions
InvalidOperationException- A value does not have the type of its property.
ToByteArray()
OabFile.csReturns the content of the file.
public byte[] ToByteArray()Returns
byte[] The content.
Exceptions
InvalidOperationException- A value does not have the type of its property.