Trouble creating meeting request

Ask your Windows 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.
Locked
User avatar
ralfii
Posts: 10
Joined: Sun Mar 03, 2013 12:44 pm

Trouble creating meeting request

Post by ralfii » Fri Aug 10, 2018 3:54 am

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.  
  3.         $ol = new-object -comObject Outlook.Application
  4.  
  5.         $olNamespace = $ol.GetNamespace("MAPI")
  6.  
  7.         $calendar = $olNamespace.Folders("Path to the folder where the appointment is created in")
  8.  
  9.         $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: 5437
Joined: Thu Aug 18, 2011 4:56 am

Re: Trouble creating meeting request

Post by davidc » Fri Aug 10, 2018 7:10 am

[TOPIC MOVED TO WINDOWS POWERSHELL FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.

User avatar
jvierra
Posts: 12761
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Trouble creating meeting request

Post by jvierra » Fri Aug 10, 2018 7:45 am

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

$appointment = $ol.CreateItem('olAppointmentItem')

User avatar
ralfii
Posts: 10
Joined: Sun Mar 03, 2013 12:44 pm

Re: Trouble creating meeting request

Post by ralfii » Mon Aug 13, 2018 12:01 am

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

User avatar
jvierra
Posts: 12761
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Trouble creating meeting request

Post by jvierra » Mon Aug 13, 2018 12:08 am

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)

Locked