Hi JJ try this:
# Load the Outlook COM object
Add-Type -AssemblyName "Microsoft.Office.Interop.Outlook"
$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNamespace("MAPI")
# Get the account to send from
$account = $namespace.Accounts | Where-Object {$_.SmtpAddress -eq "user@domino"}
# Create a new appointment item
$appointment = $outlook.CreateItem(1) # 1 = olAppointmentItem
# Set the appointment properties
$appointment.Subject = "Meeting Subject"
$appointment.Body = "Meeting description goes here."
$appointment.Location = "Meeting Location"
$appointment.Start = (Get-Date).AddDays(1).AddHours(9) # Tomorrow at 9 AM
$appointment.Duration = 60 # Duration in minutes
# Add recipients
$recipients = @("user1@domino", "user2@domino", "user3@domino")
foreach ($recipient in $recipients) {
$appointment.Recipients.Add($recipient)
}
# Set the sending account
$appointment.SendUsingAccount = $account
# Send the meeting invitation
$appointment.Send()
# Clean up
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($outlook) | Out-Null
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
This script does the following:
- Loads the Outlook COM object.
- Finds the specified sending account (user@domino).
- Creates a new appointment item.
- Sets the appointment properties (subject, body, location, start time, duration).
- Adds recipients to the appointment.
- Sets the sending account.
- Sends the meeting invitation.
- Cleans up the COM objects to prevent memory leaks.
P.S
Replace "user@domino" with the actual email address you want to send from. Modify the recipient list in the $recipients array. Adjust the appointment properties (subject, body, location, start time, duration) as needed.
Remember to run this script on a machine with Outlook installed and properly configured with the sending account.