Wednesday, August 14, 2013

Powershell and Outlook: Create a New Outlook Task using Powershell OutlookTools Module.

 

Hi,

Good Evening everyone.

In my previous posts we have created new, contacts, calendar meeting using Powershell and now it is time to create outlook tasks using Powershell.

I have converted all functions to the module and you can download the module from my Github repository.

“OutlookTools” Module download link: https://github.com/AmanDhally/OutlookTools 

Let’s start

 

  1. First download the “OutlooTools.Psm1” and .psd1 file fromhttps://github.com/AmanDhally/OutlookTools
  2. Create a folder Name “OutlookTools” in “Libraries\Documents\WindowsPowershell\Modules
  3. and paste both files there.

12-08-2013 1 
Now open Powershell console and run the cmdlet, 


 

Import-Module OutlookTools
12-08-2013 2 

 

By running the Get-Command cmdlet, we can see which cmdlet and function this modules had added.


 

Get-Command -Module outlooktools

1

You can see a new cmdlet New-OutlookTask  (basically function is there).

Like previous functions the New-OutlookTask is based on Outlook.Application com object too. While writing this module i was wondering that how amazing and simple Powershell is.

I think one day, i will write a post about how awesome Powershell is ;o).

Okey, Our Module is imported and now lets see some examples of creating a Outlook tasks using our New-OutlookTask function in OutlookTools Module.

Example : 1

Lets create a simplest task, with just a subject using the –Subject Parameter,

New-OutlookTask -Subject "Going to visit Alice in wonderland"

14-08-2013 1

and you can see that task name “Going to visit Alice in Wonderland” appeared in the Outlook task list.

14-08-2013 2

Example: 2

Lets create a task with some extra notes using parameter -Notes

New-OutlookTask -Subject "Visit Captain Jack Sparrow" -Notes " He lives near Caribbean"

 

 

14-08-2013 3

You can see that , task is appeared in the Outlook and it has the note which we defined using –Notes parameter.

14-08-2013 4

Example: 3

Let’s create a task with high importance and with a specific start date.

New-OutlookTask -Subject "Metting with Mr. Harrry Potter" -Importance 2 -StartDate "08/15/2013 19:00 "

 

 14-08-2013 5

You can see that. this task has the start date and High Priority and mentioned in above function.

14-08-2013 6

Example: 4

Lets create  a simple task with no reminders.

New-OutlookTask -Subject "Meeting with Tony" -Notes "ask him about Startreak" -EnableReminder $false

 

 14-08-2013 7

You can see that in this task, there is no reminder is set.

14-08-2013 8

Example: 5

Lets create a final task with start date, due date and with reminder set.

New-OutlookTask -Subject "Search for Avengers" -Notes "I goona find them" -Importance 2 -StartDate "08/15/2013"-DueDate "08/19/2013" -ReminderTime "08/17/2013 10:30"

 

 

14-08-2013 9

You can see that , everything is set :) .

14-08-2013 10

I hope you will enjoy it.

“OutlookTools” Module download link: https://github.com/AmanDhally/OutlookTools 

I hope you will like it :)

 

Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

1 comment:

  1. Beautiful script. How can I permanently import these tools into powershell?

    ReplyDelete