Thursday, August 8, 2013

Powershell and Outlook: Create Calendar Meetings using Powershell function.

 

Hi,

Good Evening Guys.

I hope you had enjoyed my yesterday post about Powershell and iTunes. 

In my point of view the main purpose of scripting is , making our lives easy, click free, error free and have some fun in spare time using automate tasks and automation improve productivity and efficiency.

I spent most of my time on “Powershell console” or in “Powershell ISE Editor”.

Sometime while you are working on a script or testing sometime at the same time, you remembered that tomorrow is your friends birthday or you suppose to meet with some tomorrow, at that point , you open your outlook and create a calendar meeting with a reminder.

I often end up to this situation and on the same time, I remembered something but i forget to add it to my calendar as a meeting. This is frustrating at-least for me.

I want to create a calendar invites using my Powershell Console,  I was thinking what if , if i create a Calendar event with basic parameters, so that i can use it on the fly and then never forget any meeting.

First  I thought i create a script but that is not a solution, then i end up by writing a Powershell function.

You can download the script from : https://dl.dropboxusercontent.com/u/17858935/Outlook-Calenders-Function.zip

How this works,

Please download the script and it has a complete comment base help.

I am using “Outlook.Application” com object in this Powershell functions.

Let me show.

The name of the function is “Add-CalendarMeeting” and it has three mandatory parameters , –Subject , –Body, and –Location.

In below command i run the Add-CanendatMeeting script code in Powershell.

Add-CalendarMeeting -Subject "Screenshot" -Body "testing Function" -Location "My Desk" -EnableReminder $false

08-08-2013 1

and meeting named-“Screenshot” appeared in my outlook Calendar.

08-08-2013 2

Lets open the “Screenshot” meeting and see what it has.

You can see, the meeting “ScreenShot” doesn’t has Reminder Set, and you can check we set the –EnableReminder to $false  in above script code. and the Subject,Location, and body exactly match with our above script block.

By default this function create a meeting of duration for 30 Minutes.

08-08-2013 3

Lets run the another example.

In the below script code, i am creating an all day event.

Run the script code.

Add-CalendarMeeting -Subject "Show Power of POSH" -Body "Be ready for the the fun" -Location "Pataya" -AllDayEvent $true

08-08-2013 4 

You can see that the meeting is appeared in my all day window. Let open the meeting properties and see what we have got.

1

You can see it has all the properties which we passed to the Add-CalendarMetting function.

Note: Make sure whenever you create a ALL Day Event using the function then set –EnableReminder to $false.

08-08-2013 6

Lets see another example.

Create a meeting on a specific date and time  with the duration of 30 minutes and set the priority to HIGH and set the reminder to show 30 minutes before meeting starts.

Add-CalendarMeeting -Subject "Call Supplier" -Body "chasing supplier for laptop" -Location "India" -MeetingStart "08/08/2013 20:01" -MeetingDuration 30 -Importance 2 -Reminder 30

run the above function in to the Powershell.

08-08-2013 7

and here are the result. and let open this meeting and see it properties.

08-08-2013 8

You can see in the below screenshot that, priority are set to HIGH , and reminder are set to 30 Minutes and it is starting on the time which we has specified in the above script code.

08-08-2013 9

Need to remember the Parameter –Importance value and the valid arguments.

      -Importance

Value

Meaning

0

Low

1

Normal

2

High

and the valid argument values for the parameter –BusyStatus

      -BusyStatus

Value

Meaning

0

Free

1

Tentative

2

Busy

3

Out of Office

You can download the script from : https://dl.dropboxusercontent.com/u/17858935/Outlook-Calenders-Function.zip

I hope that you may like this post.

Thanks
Aman Dhally
 
 
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

10 comments:

  1. Hi, When I executed the script, I am not getting the Add-CalendarMeeting function imported. So, I changed this script to module and it worked.. good one

    ReplyDelete
    Replies
    1. Hi Chaitanya,

      That is i am going to do next. Creating it in to a module.


      Thanks and i am glad that you liked it.

      thanks
      aman

      Delete
    2. Chaitanya, you should have dot sourced the script... type a period and a blank space and then type the path to the script file. That way the function will become available in the global scope.

      Nice function by the way! Grts.

      Delete
  2. Hi Aman Dhally ,
    I need your help. I want to delete all meeting invite from a user to all the other mailbox . User mailbox is not present now as he has left the company and his mailbox has been removed.

    I am not good in Powershell so can you please help me to solve this.

    ReplyDelete
    Replies
    1. Hi Sunil,

      I am this seems bit tricky, i haven't tried this before.
      Currently, i am bit busy with my other work, Once i get free i definitely look in to this.

      Meanwhile, please try to post your question on power shell forums. you will get the quick response there.

      But, i think, if you want to delete all meeting invites on all mailboxes, that doest sound good to me, and those meeting should have some vaulable data, and what if,someone want to keep those meeting too?

      t
      aman

      Delete
  3. Chaitanya, so far I like your script a lot. I was wondering however, is it possible to specify the calendar that the appointment is put on? We have a "sysadmins" team calendar and this is where I need to put the appointments so that my whole team can see them.
    REF

    ReplyDelete
  4. hi, i have gone through your blog its so fantastic work you have done their. i would like to have more information from you...thanks for doing the great job..cheerup!
    Meetings in Delhi Hotels

    ReplyDelete
  5. Hello, how create in another mailbox/calendar, i have 2 account in may outlook.

    THX

    ReplyDelete
  6. What about date and time?

    ReplyDelete
  7. Hi Aman,

    Is there a way I can use powershell to set a global appointment reminder to everyone in the company to fill their timesheet without showing the response of "Accept/Decline" without any end date.

    Thanks,

    ReplyDelete

Note: Only a member of this blog may post a comment.