How to turn an Outlook Calendar Invite body into html using PowerShell

JGC26 1 Reputation point
2021-11-17T14:00:45.253+00:00

Hello,

I have this code (which I did not write) that I run in Windows PowerShell to create MS Outlook meeting invites and it works wonderfully. What I'd like to do though, is to be able to turn the "$meeting.Body" into an html body. I'd like to basically take any html code and add it into that "field" so that I can change the look and feel of the email body for the invitation.

Thank you very much for any help.

$meetingDate = Get-date "11/26/2021 5:00PM"
$ol = New-Object -ComObject Outlook.Application
$meeting = $ol.CreateItem('olAppointmentItem')
$meeting.Subject = 'This is your meeting invite'
$meeting.Body = 'Please join me in this meeting to discuss multiple issues'
$meeting.Location = 'My Office'
$meeting.ReminderSet = $true
$meeting.Importance = 1
$meeting.MeetingStatus = [Microsoft.Office.Interop.Outlook.OlMeetingStatus]::olMeeting
$meeting.Recipients.Add('username@Karima ben .com')
$meeting.ReminderMinutesBeforeStart = 15
$meeting.Start = $meetingDate
$meeting.Duration = 30
$meeting.Send()

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,363 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 44,776 Reputation points
    2021-11-17T19:53:22.47+00:00

    I'm pretty sure the limitation is with the Outlook Object Model, or perhaps with the very nature of the type of item you're creating. You may have to resort to using Rich-Text Format (RTF) to accomplish this.

    There are examples of doing that if you're willing to look for VB code and then translate it.

    I expect you'll find more qualified people to answer questions about Outlook by adding an appropriate tag to your original message.

    0 comments No comments

  2. Limitless Technology 39,351 Reputation points
    2021-12-16T17:45:37.573+00:00

    Try using "Set-MailboxAutoReplyConfiguration", see the options for using it in the article below:

    https://learn.microsoft.com/en-us/powershell/module/exchange/set-mailboxautoreplyconfiguration?view=exchange-ps

    -----

    --If the answer is helpful, please vote positively and accept the answer--

    0 comments No comments