# Edit senton in msg file

**URL:** <https://forums.powershell.org/t/edit-senton-in-msg-file/19027>\
**Category:** PowerShell Help\
**Created:** [April 6, 2022, 6:02am UTC](https://forums.powershell.org/t/edit-senton-in-msg-file/19027 "2022-04-06T06:02:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![taps](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@taps](https://forums.powershell.org/u/taps)\
**Post date:** [April 6, 2022, 6:02am UTC](https://forums.powershell.org/t/edit-senton-in-msg-file/19027/1 "2022-04-06T06:02:19Z")

</div>

Hello, I need edit senton in msg file, but script show error The object does not support this method. Exist other option? Thank you

```auto
$outlook = New-Object -comobject outlook.application
$msg = $outlook.CreateItemFromTemplate("C:\my.msg")
$msg.Senton = $msg.Senton -replace "05.04.2022", "03.04.2022"
$msg.saveas("C:\my.msg")

```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 6, 2022, 6:50am UTC](https://forums.powershell.org/t/edit-senton-in-msg-file/19027/2 "2022-04-06T06:50:17Z")

</div>

Could you please share the complete error message formatted as code and translated to english?

Thanks in advance

You may consider using

> **[Send-MailMessage (Microsoft.PowerShell.Utility) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.2)**
>
> The Send-MailMessage cmdlet sends an email message from within PowerShell. You must specify a Simple Mail Transfer Protocol (SMTP) server or the Send-MailMessage command fails. Use the SmtpServer parameter or set the $PSEmailServer variable to a...

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [April 6, 2022, 7:50am UTC](https://forums.powershell.org/t/edit-senton-in-msg-file/19027/3 "2022-04-06T07:50:07Z")

</div>

The `SentOn` property is Read Only, you can’t set it:

```auto
PS E:\Temp>$msg | Get-Member

SentOn Property Date SentOn () {get}

```

> **[MailItem.SentOn property (Outlook)](https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.senton)**
>
> Office VBA reference topic

---

<div class="post-metadata">

**Author:** ![taps](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@taps](https://forums.powershell.org/u/taps)\
**Post date:** [April 6, 2022, 7:51am UTC](https://forums.powershell.org/t/edit-senton-in-msg-file/19027/4 "2022-04-06T07:51:10Z")

</div>

```auto
The object does not support this method.
At C:\file.ps1:3 char:1
+ $msg.Senton= $msg.Senton -replace "05.04.2022", "03.04.2022"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:18pm UTC](https://forums.powershell.org/t/edit-senton-in-msg-file/19027/5 "2024-05-16T20:18:03Z")

</div>

Closed on May 16, 2024, 8:18pm UTC


