# EmailStorePstMutationTransaction

Stages folder and item changes against an existing Unicode PST and commits them as a verified atomic rewrite.

Class 

`OfficeIMO.Email.Store`

**Namespace**

`OfficeIMO.Email.Store`

**Assembly**

`OfficeIMO.Email`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[EmailStorePstMutationTransaction.cs:45](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L45)

**Implements**

`IDisposable`

**Modifiers**

sealed

Stages folder and item changes against an existing Unicode PST and commits them as a verified atomic rewrite. Disposing an uncommitted transaction leaves the source byte-for-byte unchanged.

## Inheritance

- object
- EmailStorePstMutationTransaction

## 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

- Method [EmailStorePstMutationTransaction.Open](/api/email/officeimo-email-store-emailstorepstmutationtransaction/#method-open-string-officeimo-email-store-emailstorepstmutationoptions-threading-cancellationtoken)

Filter members 

Show inherited

## Methods

`public string AddItem(string folderId, EmailDocument document, bool isAssociated = false, CancellationToken cancellationToken = default)` [#](#method-additem-string-officeimo-email-emaildocument-boolean-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:118](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L118)

Adds an item and returns its transaction-local identifier.

Parameters

**folderId string required**

**document OfficeIMO.Email.EmailDocument required**

**isAssociated bool = false optional**

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

Returns

`string`

`public EmailStorePstMutationReport Commit(CancellationToken cancellationToken = default)` [#](#method-commit-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Commit.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Commit.cs#L13)

Writes and verifies a staged Unicode PST, optionally commits a byte-for-byte backup, and atomically replaces the original. Any failure before the final commit leaves the original unchanged.

Parameters

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

Returns

`EmailStorePstMutationReport`

`public async Task<EmailStorePstMutationReport> CommitAsync(CancellationToken cancellationToken = default)` [#](#method-commitasync-threading-cancellationtoken)

Writes and verifies a staged Unicode PST, asynchronously flushes the staged artifact and optional byte-for-byte backup, then atomically replaces the original. Ordered PST serialization and semantic comparison remain synchronous stateful phases and are not hidden in a worker-thread wrapper.

Parameters

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

Returns

`Task<EmailStorePstMutationReport>`

`public EmailStorePstFolderCopyResult CopyFolder(string folderId, string destinationParentFolderId, bool includeDescendants = true, EmailStorePstCopyConflictPolicy conflictPolicy = Fail, CancellationToken cancellationToken = default)` [#](#method-copyfolder-string-string-boolean-officeimo-email-store-emailstorepstcopyconflictpolicy-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:170](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L170)

Copies a source folder, optionally including its complete subtree and items.

Parameters

**folderId string required**

**destinationParentFolderId string required**

**includeDescendants bool = true optional**

**conflictPolicy OfficeIMO.Email.Store.EmailStorePstCopyConflictPolicy = Fail optional**

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

Returns

`EmailStorePstFolderCopyResult`

`public string CopyItem(string itemId, string destinationFolderId, bool? isAssociated = null, CancellationToken cancellationToken = default)` [#](#method-copyitem-string-string-nullable-system-boolean-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:149](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L149)

Copies an existing source item into another folder and returns a transaction-local identifier.

Parameters

**itemId string required**

**destinationFolderId string required**

**isAssociated bool? = null optional**

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

Returns

`string`

`public string CreateFolder(string name, string? parentFolderId = null, string? containerClass = null)` [#](#method-createfolder-string-string-string)

[EmailStorePstMutationTransaction.Operations.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L9)

Creates a folder and returns its transaction-local identifier.

Parameters

**name string required**

**parentFolderId string? = null optional**

**containerClass string? = null optional**

Returns

`string`

`public void DeleteFolder(string folderId, bool recursive = false, CancellationToken cancellationToken = default)` [#](#method-deletefolder-string-boolean-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:79](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L79)

Deletes a non-mandatory folder. A non-empty folder requires recursive. Recursive deletion includes active descendants and their items.

Parameters

**folderId string required**

**recursive bool = false optional**

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

`public void DeleteItem(string itemId, CancellationToken cancellationToken = default)` [#](#method-deleteitem-string-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:390](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L390)

Deletes an existing or newly staged item.

Parameters

**itemId string required**

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

`public void Dispose()` [#](#method-dispose)

[EmailStorePstMutationTransaction.cs:169](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L169)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

`public EmailStorePstMutationPlan DryRun(CancellationToken cancellationToken = default)` [#](#method-dryrun-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:322](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L322)

Returns a value-free dry run of every effective staged operation without writing an artifact.

Parameters

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

Returns

`EmailStorePstMutationPlan`

`public IEnumerable<EmailStoreItemReference> EnumerateItems()` [#](#method-enumerateitems)

Enumerates active source item references after staged deletes.

Returns

`IEnumerable<EmailStoreItemReference>`

`public void MoveFolder(string folderId, string newParentFolderId)` [#](#method-movefolder-string-string)

[EmailStorePstMutationTransaction.Operations.cs:43](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L43)

Moves a non-mandatory folder below another active folder.

Parameters

**folderId string required**

**newParentFolderId string required**

`public void MoveItem(string itemId, string destinationFolderId, CancellationToken cancellationToken = default)` [#](#method-moveitem-string-string-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:374](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L374)

Moves an existing or newly staged item to another active folder.

Parameters

**itemId string required**

**destinationFolderId string required**

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

`public static EmailStorePstMutationTransaction Open(string path, EmailStorePstMutationOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-open-string-officeimo-email-store-emailstorepstmutationoptions-threading-cancellationtoken)

[EmailStorePstMutationTransaction.cs:45](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L45)

Opens and locks an existing Unicode PST for one mutation transaction.

Parameters

**path string required**

**options OfficeIMO.Email.Store.EmailStorePstMutationOptions? = null optional**

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

Returns

`EmailStorePstMutationTransaction`

`public void PatchItem(string itemId, EmailStoreItemPatch patch, CancellationToken cancellationToken = default)` [#](#method-patchitem-string-officeimo-email-store-emailstoreitempatch-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:238](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L238)

Applies one reusable typed patch to an item.

Parameters

**itemId string required**

**patch OfficeIMO.Email.Store.EmailStoreItemPatch required**

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

`public void PatchItemAttachments(string itemId, EmailAttachmentPatch patch, CancellationToken cancellationToken = default)` [#](#method-patchitemattachments-string-officeimo-email-emailattachmentpatch-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:311](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L311)

Applies ordered, bounds-checked attachment changes to an item.

Parameters

**itemId string required**

**patch OfficeIMO.Email.EmailAttachmentPatch required**

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

`public void PatchItemProperties(string itemId, MapiPropertyPatch patch, CancellationToken cancellationToken = default)` [#](#method-patchitemproperties-string-officeimo-email-mapipropertypatch-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:299](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L299)

Applies exact typed MAPI property changes after normal semantic projection when the item is rewritten.

Parameters

**itemId string required**

**patch OfficeIMO.Email.MapiPropertyPatch required**

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

`public EmailStorePstMutationSelectionReport PatchItems(EmailStoreTableQuery query, EmailStoreItemPatch patch, CancellationToken cancellationToken = default)` [#](#method-patchitems-officeimo-email-store-emailstoretablequery-officeimo-email-store-emailstoreitempatch-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:256](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L256)

Applies one reusable typed patch to every row selected by a bounded table query. Selection completes before any item is changed, and a scan-limit result is rejected rather than partially mutating the transaction.

Parameters

**query OfficeIMO.Email.Store.EmailStoreTableQuery required**

**patch OfficeIMO.Email.Store.EmailStoreItemPatch required**

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

Returns

`EmailStorePstMutationSelectionReport`

`public EmailStoreItem ReadItem(string itemId, CancellationToken cancellationToken = default)` [#](#method-readitem-string-threading-cancellationtoken)

[EmailStorePstMutationTransaction.cs:158](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L158)

Reads one source item by its stable source identifier.

Parameters

**itemId string required**

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

Returns

`EmailStoreItem`

`public void RenameFolder(string folderId, string name)` [#](#method-renamefolder-string-string)

[EmailStorePstMutationTransaction.Operations.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L32)

Changes a non-mandatory folder's display name.

Parameters

**folderId string required**

**name string required**

`public void ReplaceItem(string itemId, EmailDocument document, CancellationToken cancellationToken = default)` [#](#method-replaceitem-string-officeimo-email-emaildocument-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:139](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L139)

Replaces the semantic document for an existing or newly staged item.

Parameters

**itemId string required**

**document OfficeIMO.Email.EmailDocument required**

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

`public void SetItemAssociated(string itemId, bool isAssociated, CancellationToken cancellationToken = default)` [#](#method-setitemassociated-string-boolean-threading-cancellationtoken)

[EmailStorePstMutationTransaction.Operations.cs:383](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.Operations.cs#L383)

Moves an item between normal contents and folder-associated contents.

Parameters

**itemId string required**

**isAssociated bool required**

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

## 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 string SourcePath { get; }` [#](#property-sourcepath)

[EmailStorePstMutationTransaction.cs:130](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L130)

Full path of the PST that will be replaced only after a successful commit.

`public string RootFolderId { get; }` [#](#property-rootfolderid)

[EmailStorePstMutationTransaction.cs:133](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L133)

Source folder identifier used when a new folder omits its parent.

`public IReadOnlyList<EmailStorePstMutationFolder> Folders { get; }` [#](#property-folders)

[EmailStorePstMutationTransaction.cs:138](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Store/Mutation/EmailStorePstMutationTransaction.cs#L138)

Current staged folder view. Transaction-local identifiers remain stable until commit.

<!-- PowerForge markdown artifact sha256:9E3F1EB314DE2B839F6E9D2BD4D9C5FFEC7295C84F122145E9B9C541D0837025 -->
