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

Monday, August 12, 2013

Powershell and Outlook: Create a new Outlook Contacts using Powershell Module.


Hi,
Good Evening everyone.
In my previous post, we created a Powershell function using Ms Outlook com objects. That functions creates new  calendar meetings.
We use that function on Powershell console or in our scripts too.
Today I converted the script in to module , so that we can use it whenever we want.
I named the module to “OutlookTools”.
Today i added one more function to the module.
Now we can create a new Outlook contact using this new function. The Name of the function is “New-OutlookContact”.
Using “New-OutlookContact” we can create a new contact on the Powershell console, without switching to the Outlook applications.
How to do that.
Let me show you.,
  1. First download the “OutlooTools.Psm1” and .psd1 file from https://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
a
In my previous post, I already explained about “New-OutlookCalendarMeeting” ,  and the “New-outlookContact” is a new function.
As I mentioned above that using “New-OutlookContact” we can create a new outlook contacts.
lets try creating some contacts.
Example : 1
Create a new simple outlook contact using first name and last name.
New-OutlookContact -FirstName "jhonson" -LastName "Smit
12-08-2013 3
and here is the result in Outlook.
12-08-2013 4
Example 2  :
Create  a new contact with Mobile Number.
New-OutlookContact -FirstName "Ajit" -LastName "Singh" -MobileNumber "9910129889"
12-08-2013 5
and here is the result again.
12-08-2013 6
Example : 3
Create another outlook contact, with website, and company name field.
New-OutlookContact -FirstName "Jujhar" -LastName "Singh" -Website "www.js.com" -Company "Jujhar Studio"
12-08-2013 7
and it works well too.
12-08-2013 8
Example : 4
Create an another contact with , Notes, and Job title and business address.
New-OutlookContact -FirstName "Jorawar" -LastName "Singh" -BusinessAddress "Sarhind, Punjab" -JobTitle "Warrior" -Notes "I saw him in a Sikh Temple"
12-08-2013 9
working perfectly.
12-08-2013 10
Example:5
Lets use all parameters.
New-OutlookContact -FirstName "Fateh" -LastName "Singh" -Birthday "05/01/1999" -BusinessPhone "0999999" -BusinessAddress 'Sarhind, Punjab' -Company "Khalsa" -EmailAddress 'fateh@khalasa.com' -HomeAddress 'Talwandi,Punjab' -JobTitle 'warror' -MobileNumber "90909090'
12-08-2013 11
and here you go.,
12-08-2013 12
to know more about the functions, after importing OutlookTools module run.
  • Get-Help New-OutlookCalendarMeeting –Full
  • Get-Help New-OutlookContact –Full
You can download the module from below link:
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

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