Trouble creating meeting request

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
ralf_jantschek
Posts: 17
Last visit: Tue May 30, 2023 2:49 am

Trouble creating meeting request

Post by ralf_jantschek »

Hello,
I'm experiencing problems when I try to create a meeting request under a certain Outlook Version.
The following code works fine under
Outlook Version: 16.0.0.4705
  1.    
  2.         $ol = new-object -comObject Outlook.Application
  3.         $olNamespace = $ol.GetNamespace("MAPI")
  4.         $calendar = $olNamespace.Folders("Path to the folder where the appointment is created in")
  5.         $termin = $calendar.Items.Add("IPM.Appointment")
under Outlook Version: 15.0.0.5041
the last command returns: ERROR: You cannot call a method on a null-valued expression.
And
  1. $calender
is empty!


Product, version and build:
64 bit version of product:
Sapien PowerShell Studio 2018 5.5.153.0
Operating system:
64 bit OS:
Windows 10 Enterprise 1703 Build 15063.1209

*** Please add details and screenshots as needed below. ***

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Trouble creating meeting request

Post by davidc »

[TOPIC MOVED TO WINDOWS POWERSHELL FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Trouble creating meeting request

Post by jvierra »

The only correct way to create an appointment item is this:

$appointment = $ol.CreateItem('olAppointmentItem')
User avatar
ralf_jantschek
Posts: 17
Last visit: Tue May 30, 2023 2:49 am

Re: Trouble creating meeting request

Post by ralf_jantschek »

Hello,
as I have to create the appointment in different mailbox hence the
  1.  $calendar = $olNamespace.Folders("Path to the folder where the appointment is created in")
your suggestion won't work
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Trouble creating meeting request

Post by jvierra »

Pick the mailbox and save the appointment I n that mailbox.

$mailbox = $olNamespace.Stores('userid@domain.com')
$appointment = $ol.CreateItem('olAppointmentItem')
$mailbox.Folders['foldername'].Items.Add($appointment)
This topic is 5 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked