none
Need to create Meeting Request using Powershell with Outlook 2010 / 2013

    Question

  • We will be creating around 100 meeting request based on data from excel, so planning to migrate it to SQL & using powershell we need to speed-up the progress.

    Script tried :

    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/e88ca51c-62dd-493b-a0d1-ffe6a8696fdf/create-view-in-outlook-2013-using-powershell?forum=ITCG

    http://en.community.dell.com/techcenter/powergui/f/4833/t/19576698.aspx

    http://www.amandhally.net/2013/08/30/powershell-and-outlook-create-and-send-a-new-email-using-powershell-outlooktools-module/

    Do we have any working scripts, i tried few scripts it fails throwing error as below:

     

    New-Object : Exception calling ".ctor" with "0" argument(s): "Retrieving the COM class factory for component with CLSID 
    {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 
    0x80080005 (CO_E_SERVER_EXEC_FAILURE))."
    At line:2 char:6
    + $o = New-Object Microsoft.Office.Interop.Outlook.ApplicationClass
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
        + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

    You cannot call a method on a null-valued expression.
    At line:4 char:1
    + $a = $o.CreateItem($olAppointmentItem)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull



    Ganapathy


    Monday, August 04, 2014 12:35 AM

Answers

  • Adding to AnnaWY, I suspect you have opened the messages - Just close and try. May give a dice.

    tested and working code

    $olAppointmentItem = 1 
    $o = new-object -comobject outlook.application
    $a = $o.CreateItem($olAppointmentItem)
    $a.meetingstatus.olMeeting
    $a.Start = "8/4/2014 11:00 PM"
    $a.Duration = 60
    $a.Subject = "Test Meeting"
    $a.Body = "Just a test, please accept, then delete."
    $a.Location = "Here"
    $a.ReminderMinutesBeforeStart = 15
    $a.ReminderSet = $True
    $a
    $a.recipients.add("testuser@domain.com")
    $a.send()
    $result = $a.Save()

    Ensure outlook is not running while executing the code and Outlook.exe process should not run.

    I suggest to user EWS API to achieve this tasks


    Regards Chen V [MCTS SharePoint 2010]





    • Edited by Chen VMVP Monday, August 04, 2014 2:36 PM
    • Marked as answer by ganapathys_s Tuesday, August 05, 2014 5:35 PM
    Monday, August 04, 2014 1:38 PM

All replies

  • Hi Ganapathys,

    For the error "failed due to the following error: 80080005", please Make sure that Outlook and Powershell are either both running as a standard user (not elevated) or that they are both running elevated as Administrator. They need to be running at the same integrity level to avoid that error.

    Please try to run powershell as standard user without "run as admin".

    If you have any feedback on our support, please click here.

    Best Regards,

    Anna Wang

    TechNet Community Support

    Monday, August 04, 2014 11:52 AM
    Moderator
  • Adding to AnnaWY, I suspect you have opened the messages - Just close and try. May give a dice.

    tested and working code

    $olAppointmentItem = 1 
    $o = new-object -comobject outlook.application
    $a = $o.CreateItem($olAppointmentItem)
    $a.meetingstatus.olMeeting
    $a.Start = "8/4/2014 11:00 PM"
    $a.Duration = 60
    $a.Subject = "Test Meeting"
    $a.Body = "Just a test, please accept, then delete."
    $a.Location = "Here"
    $a.ReminderMinutesBeforeStart = 15
    $a.ReminderSet = $True
    $a
    $a.recipients.add("testuser@domain.com")
    $a.send()
    $result = $a.Save()

    Ensure outlook is not running while executing the code and Outlook.exe process should not run.

    I suggest to user EWS API to achieve this tasks


    Regards Chen V [MCTS SharePoint 2010]





    • Edited by Chen VMVP Monday, August 04, 2014 2:36 PM
    • Marked as answer by ganapathys_s Tuesday, August 05, 2014 5:35 PM
    Monday, August 04, 2014 1:38 PM
  • Thanks for sharing the script.

    I'm administrating Exchange 2013 and I'm new to PowerShell world.

    I tried to create the new object ($o = new-object -comobject outlook.application) from Exchange Management Shell on Exchange server and getting the below error

    ===========

    new-object : Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

    At line:1 char:6
    + $o = new-object -comobject outlook.application
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
        + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

    ===========

    Office/Outlook is not installed on the server. Is this the reason?

    Tuesday, April 26, 2016 12:05 PM
  • Hi Bob,

    indeed, that's the cause. The script Chen showed uses Outlook to create the meeting-request. Either you use the outlook components or if you want to do this completely without client components you can use EWS in order to directly connect to the server (this is more flexible but hellishly more complex for someone just starting with PowerShell). Given your experience-level I highly recommend using the Outlook/COM-object method.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Tuesday, April 26, 2016 12:55 PM
  • I have similar problem.  Can you direct me how I can achieve this? Is there any step by step instructions how can I install EWS and send meeting requests? Any help is highly appreciated.
    Wednesday, November 30, 2016 5:46 AM
  • Hi Veduri,

    you can install the managed api from the download center. As for tutorials on sending meeting requests ... this is a guide that should do the job, and here's the official documentation for C#, which is simpler but requires you to convert from C# to PowerShell. If the first is too confusing and you can't handle C#, compare the two, looking for the official documentation for the structure and the blog post for converting it into PowerShell.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Thursday, December 01, 2016 9:36 AM