# Save-OfficeEmail

Saves an email document as EML, EMLX, MSG, or TNEF with fidelity diagnostics.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Email.EmailDocument`

**Outputs**

`OfficeIMO.Email.EmailWriteResult`

**Source**

[SaveOfficeEmailCommand.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Email/SaveOfficeEmailCommand.cs#L16) 

Saves an email document as EML, EMLX, MSG, or TNEF with fidelity diagnostics.

## Syntax

```
Save-OfficeEmail
-Document <EmailDocument>
[-Format <EmailFileFormat>]
[-Options <EmailWriterOptions>]
[-PassThru]
[-Path] <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-save-officeemail-emaildocument-emailfileformat-emailwriteroptions-switchparameter-string-switchparameter-switchparameter)

Parameter set: `Document`

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Read and Convert Email Messages](/docs/email/messages-and-conversion/) Guide
  
  Read EML, MSG, OFT, and TNEF (winmail.dat) messages, convert between them, check for conversion loss, stream large attachments, and render a message to PDF.
- [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.

## Examples

### Save a message with an explicit loss policy.

```powershell
$options = New-OfficeEmailWriterOptions -ConversionLossPolicy Block
$message | Save-OfficeEmail -Path .\Message.eml -Options $options -PassThru
```

## Parameters

**-Document EmailDocument requiredpipeline: True (ByValue)**

Email document to save.

**-Format EmailFileFormat optional**

Optional explicit output format. By default it is inferred from the filename.

Possible values: `Unknown`, `Eml`, `OutlookMsg`, `Tnef`, `Mbox`, `OutlookTemplate`, `Emlx`

**-Options EmailWriterOptions optional**

Optional preservation, projection, encoding, and output limits.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Path String requiredposition: 0**

Destination path.

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

Prompts for confirmation before running the command.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:5374357CFEDCE142A0490C92E8AE131FC0FFB5855431FF6A2C01CA008D0BF417 -->
