# OutlookUserPropertyCollection

Outlook-compatible user-defined fields backed by PidLidPropertyDefinitionStream and string-named PS_PUBLIC_STRINGS values.

Class 

`OfficeIMO.Email`

**Namespace**

`OfficeIMO.Email`

**Assembly**

`OfficeIMO.Email`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[OutlookUserPropertyCollection.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L28)

**Implements**

`IReadOnlyCollection<OutlookUserProperty>` `IEnumerable<OutlookUserProperty>` `IEnumerable`

**Modifiers**

sealed

Outlook-compatible user-defined fields backed by PidLidPropertyDefinitionStream and string-named PS_PUBLIC_STRINGS values.

## Inheritance

- object
- OutlookUserPropertyCollection

## Usage

Explore 1 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 1

- Property [EmailDocument.UserProperties](/api/email/officeimo-email-emaildocument/#property-userproperties)

Filter members 

Show inherited

## Methods

`public OutlookUserProperty? Find(string name)` [#](#method-find-string)

[OutlookUserPropertyCollection.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L28)

Finds a user property case-insensitively.

Parameters

**name string required**

Returns

`OutlookUserProperty?`

`public IEnumerator<OutlookUserProperty> GetEnumerator()` [#](#method-getenumerator)

[OutlookUserPropertyCollection.cs:128](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L128)

Returns an enumerator that iterates through the collection.

Returns

`IEnumerator<OutlookUserProperty>` An enumerator that can be used to iterate through the collection.

`public T? GetValueOrDefault<T>(string name)` [#](#method-getvalueordefault-string)

[OutlookUserPropertyCollection.cs:53](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L53)

Reads a typed value or returns the managed default when it is absent or incompatible.

Type Parameters

**T**

Parameters

**name string required**

Returns

`T?`

`public bool Remove(string name)` [#](#method-remove-string)

[OutlookUserPropertyCollection.cs:108](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L108)

Removes the named value and its custom field definition.

Parameters

**name string required**

Returns

`bool` True when either a value or definition was removed.

Set 2 overloads

`public OutlookUserProperty Set(string name, object value)` [#](#method-set-string-object)

[OutlookUserPropertyCollection.cs:57](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L57)

Creates or replaces a user property, inferring its Outlook field type.

Parameters

**name string required**

**value object required**

Returns

`OutlookUserProperty`

`public OutlookUserProperty Set(string name, object value, OutlookUserPropertyType fieldType, bool allowTypeChange = false)` [#](#method-set-string-object-officeimo-email-outlookuserpropertytype-boolean)

[OutlookUserPropertyCollection.cs:68](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L68)

Creates or replaces a user property and its Outlook field definition. Existing definitions cannot be changed to a different known type unless allowTypeChange is true.

Parameters

**name string required**

**value object required**

**fieldType OfficeIMO.Email.OutlookUserPropertyType required**

**allowTypeChange bool = false optional**

Returns

`OutlookUserProperty`

`public OutlookUserProperty SetDuration(string name, TimeSpan value, bool allowTypeChange = false)` [#](#method-setduration-string-timespan-boolean)

[OutlookUserPropertyCollection.cs:103](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L103)

Creates or replaces a duration field using its natural managed representation.

Parameters

**name string required**

**value System.TimeSpan required**

**allowTypeChange bool = false optional**

Returns

`OutlookUserProperty`

`public OutlookUserProperty SetKeywords(string name, IEnumerable<string> values, bool allowTypeChange = false)` [#](#method-setkeywords-string-collections-generic-ienumerable-system-string-boolean)

[OutlookUserPropertyCollection.cs:96](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L96)

Creates or replaces a multiple-string keyword field.

Parameters

**name string required**

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

**allowTypeChange bool = false optional**

Returns

`OutlookUserProperty`

`public bool TryGetValue<T>(string name, out T? value)` [#](#method-trygetvalue-string)

[OutlookUserPropertyCollection.cs:35](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L35)

Attempts to read and convert a user property's value.

Type Parameters

**T**

Parameters

**name string required**

**value T? required**

Returns

`bool`

## 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 OutlookUserPropertyDefinitionState DefinitionState { get; }` [#](#property-definitionstate)

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

State of the item's complete field-definition stream.

`public string? DefinitionError { get; }` [#](#property-definitionerror)

[OutlookUserPropertyCollection.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L18)

Parse error for a corrupt or unsupported definition stream.

`public IReadOnlyList<OutlookUserPropertyDefinition> Definitions { get; }` [#](#property-definitions)

[OutlookUserPropertyCollection.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L21)

Every decoded field definition, including preserved built-in bindings.

`public int Count { get; }` [#](#property-count)

[OutlookUserPropertyCollection.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Outlook/OutlookUserPropertyCollection.cs#L24)

Gets the number of elements in the collection.

<!-- PowerForge markdown artifact sha256:EAF6770F0EE6852D3E0294933DCC45C34B15CFB501A900275ACCAC14FC72B4E7 -->
