# VCardDocument

A standalone vCard stream containing one or more ordered VCARD objects.

Class 

`OfficeIMO.Email`

**Namespace**

`OfficeIMO.Email`

**Assembly**

`OfficeIMO.Email`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[VCardDocument.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L15)

**Modifiers**

sealed

A standalone vCard stream containing one or more ordered VCARD objects.

## Inheritance

- object
- VCardDocument

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Read and Edit Calendars, Contacts, and Outlook Items](/docs/email/calendars-and-contacts/) Guide
  
  Read and update iCalendar (ICS), vCalendar, and vCard files, and expand Outlook appointment recurrence with OfficeIMO.Email.
- [Read, Write, and Convert Email and Outlook Files](/docs/email/) Guide
  
  OfficeIMO.Email reads and writes EML, MSG, OFT, TNEF, PST, OST, OLM, mbox, calendar and contact files in .NET, with no Outlook installed.

## Usage

Explore 7 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 7

- Property [EmailDataOpenResult.Contact](/api/email/officeimo-email-data-emaildataopenresult/#property-contact)
- Method [EmailContactConsolidation.Consolidate](/api/email/officeimo-email-emailcontactconsolidation/#method-consolidate-officeimo-email-emailcontactreviewresult-int32-collections-generic-ireadonlydictionary-system-string-system-int32-threading-cancellationtoken)
- Method [EmailPortableContentCollection.ToVCards](/api/email/officeimo-email-emailportablecontentcollection/#method-tovcards-collections-generic-ienumerable-officeimo-email-emaildocument-officeimo-email-emailportablecontentexportoptions-int32-threading-cancellationtoken)
- Method [EmailPortableContentExport.ToVCard](/api/email/officeimo-email-emailportablecontentexport/#method-tovcard-officeimo-email-emaildocument-officeimo-email-emailportablecontentexportoptions-threading-cancellationtoken)
- Method [VCardDocument.Load](/api/email/officeimo-email-vcarddocument/#method-load-byte-officeimo-email-contentlinereaderoptions)
- Method [VCardDocument.LoadAsync](/api/email/officeimo-email-vcarddocument/#method-loadasync-string-officeimo-email-contentlinereaderoptions-threading-cancellationtoken)
- Method [VCardDocument.Parse](/api/email/officeimo-email-vcarddocument/#method-parse-string-officeimo-email-contentlinereaderoptions)

Filter members 

Show inherited

## Constructors

`public VCardDocument()` [#](#constructor-ctor)

[VCardDocument.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L15)

Creates a document with one vCard 4.0 card.

## Methods

`public ContentLineComponent AddCard(VCardVersion version = V4_0)` [#](#method-addcard-officeimo-email-vcardversion)

[VCardDocument.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L31)

Adds an empty card with an explicit VERSION property.

Parameters

**version OfficeIMO.Email.VCardVersion = V4_0 optional**

Returns

`ContentLineComponent`

`public ContentLineComponent AddGroup(string formattedName, IEnumerable<string> memberUris)` [#](#method-addgroup-string-collections-generic-ienumerable-system-string)

[VCardDocument.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L39)

Adds an RFC 6350 group card with ordered MEMBER URI properties.

Parameters

**formattedName string required**

**memberUris System.Collections.Generic.IEnumerable<string> required**

Returns

`ContentLineComponent`

`public static VCardVersion GetVersion(ContentLineComponent card)` [#](#method-getversion-officeimo-email-contentlinecomponent)

[VCardDocument.cs:59](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L59)

Gets a card's declared syntax version.

Parameters

**card OfficeIMO.Email.ContentLineComponent required**

Returns

`VCardVersion`

Load 3 overloads

`public static VCardDocument Load(byte[] bytes, ContentLineReaderOptions? options = null)` [#](#method-load-byte-officeimo-email-contentlinereaderoptions)

[VCardDocument.cs:82](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L82)

Loads a vCard stream from memory.

Parameters

**bytes byte[] required**

**options OfficeIMO.Email.ContentLineReaderOptions? = null optional**

Returns

`VCardDocument`

`public static VCardDocument Load(string filePath, ContentLineReaderOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-load-string-officeimo-email-contentlinereaderoptions-threading-cancellationtoken)

[VCardDocument.cs:88](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L88)

Loads a vCard file.

Parameters

**filePath string required**

**options OfficeIMO.Email.ContentLineReaderOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`VCardDocument`

`public static VCardDocument Load(Stream stream, ContentLineReaderOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-load-io-stream-officeimo-email-contentlinereaderoptions-threading-cancellationtoken)

[VCardDocument.cs:95](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L95)

Loads from a caller-owned stream without closing it.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Email.ContentLineReaderOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`VCardDocument`

LoadAsync 2 overloads

`public static async Task<VCardDocument> LoadAsync(string filePath, ContentLineReaderOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-loadasync-string-officeimo-email-contentlinereaderoptions-threading-cancellationtoken)

Asynchronously loads a vCard file.

Parameters

**filePath string required**

**options OfficeIMO.Email.ContentLineReaderOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<VCardDocument>`

`public static async Task<VCardDocument> LoadAsync(Stream stream, ContentLineReaderOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-loadasync-io-stream-officeimo-email-contentlinereaderoptions-threading-cancellationtoken)

Asynchronously loads from a caller-owned stream without closing it.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Email.ContentLineReaderOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<VCardDocument>`

`public static VCardDocument Parse(string text, ContentLineReaderOptions? options = null)` [#](#method-parse-string-officeimo-email-contentlinereaderoptions)

[VCardDocument.cs:77](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L77)

Parses a vCard stream from text.

Parameters

**text string required**

**options OfficeIMO.Email.ContentLineReaderOptions? = null optional**

Returns

`VCardDocument`

Save 2 overloads

`public void Save(string filePath, ContentLineWriterOptions? options = null)` [#](#method-save-string-officeimo-email-contentlinewriteroptions)

[VCardDocument.cs:132](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L132)

Atomically saves this document to a file.

Parameters

**filePath string required**

**options OfficeIMO.Email.ContentLineWriterOptions? = null optional**

`public void Save(Stream stream, ContentLineWriterOptions? options = null)` [#](#method-save-io-stream-officeimo-email-contentlinewriteroptions)

[VCardDocument.cs:136](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L136)

Saves this document to a caller-owned stream without closing it.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Email.ContentLineWriterOptions? = null optional**

SaveAsync 2 overloads

`public Task SaveAsync(string filePath, ContentLineWriterOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-saveasync-string-officeimo-email-contentlinewriteroptions-threading-cancellationtoken)

[VCardDocument.cs:141](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L141)

Asynchronously atomically saves this document to a file.

Parameters

**filePath string required**

**options OfficeIMO.Email.ContentLineWriterOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task`

`public Task SaveAsync(Stream stream, ContentLineWriterOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-saveasync-io-stream-officeimo-email-contentlinewriteroptions-threading-cancellationtoken)

[VCardDocument.cs:146](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L146)

Asynchronously saves to a caller-owned stream without closing it.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Email.ContentLineWriterOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task`

`public string Serialize(ContentLineWriterOptions? options = null)` [#](#method-serialize-officeimo-email-contentlinewriteroptions)

[VCardDocument.cs:126](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L126)

Serializes this document to text using the configured output encoding.

Parameters

**options OfficeIMO.Email.ContentLineWriterOptions? = null optional**

Returns

`string`

`public static void SetVersion(ContentLineComponent card, VCardVersion version)` [#](#method-setversion-officeimo-email-contentlinecomponent-officeimo-email-vcardversion)

[VCardDocument.cs:67](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L67)

Replaces a card's declared syntax version.

Parameters

**card OfficeIMO.Email.ContentLineComponent required**

**version OfficeIMO.Email.VCardVersion required**

`public byte[] ToBytes(ContentLineWriterOptions? options = null)` [#](#method-tobytes-officeimo-email-contentlinewriteroptions)

[VCardDocument.cs:117](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L117)

Serializes this document to bytes.

Parameters

**options OfficeIMO.Email.ContentLineWriterOptions? = null optional**

Returns

`byte[]`

`public IReadOnlyList<ContentLineValidationIssue> Validate()` [#](#method-validate)

[VCardDocument.Validation.cs:10](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.Validation.cs#L10)

Validates version-specific stable vCard contracts while retaining extension properties.

Returns

`IReadOnlyList<ContentLineValidationIssue>`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public IList<ContentLineComponent> Cards { get; }` [#](#property-cards)

[VCardDocument.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Contact/VCardDocument.cs#L27)

Ordered VCARD roots. Repeated, grouped, unknown, and extension properties are retained.

<!-- PowerForge markdown artifact sha256:2E7BDCF69580D5C8D8E4C989B7A66626AF39CFB317A5B5D2CC1CB660660899FF -->
