header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Populating Outlook tasks with a cmdlet a day
Last Post 28 Nov 2007 03:54 PM by KarlMitschke. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
steve215User is Offline
New Member
New Member
Posts:6

--
27 Nov 2007 10:02 PM  

Today I read Don Jones' article in the December 2007 edition of TechNet Magazine entitled "Digging Deeper". In the article Don suggests taking a few minutes a day to review a cmdlet.

Populating my Outlook tasks with a cmdlet a day seemed like a good script project. So after borrowing liberally from Lee Holmes' "Precision Computing" blog entry on Outlook Task Automation, here is what I came up with.

$cmds = get-command | select name | %{"Reveiw the "+$_.name+" cmdlet"}

$objcol = @()

$daysadd =1

foreach ($cmd in $cmds){

$tskitem = ""|select Description,Dt,Tm,Category

IF ((Get-Date).adddays($daysadd).dayofweek -eq "Saturday" )

{

$daysadd = $daysadd +2

}#end if

elseif ((Get-Date).adddays($daysadd).dayofweek -eq "Sunday")

{

$daysadd = $daysadd +1

}#end elseif

$tskitem.Dt = (Get-Date "8:30 AM").adddays($daysadd)

$tskitem.Tm = (Get-Date "8:30 AM").adddays($daysadd)

$tskitem.Description = $cmd

$tskitem.Category = "PS cmdlet Review"

$objcol += $tskitem

$daysadd = $daysadd +1

}#end foreach



$olTaskItem
= "olTaskItem"

$olFolderTasks = "olFolderTasks"

$outlook = New-Object -Com Outlook.Application

foreach ($tsk in $objcol){

$task = $outlook.Application.CreateItem($olTaskItem)

$task.Subject = $tsk.Description

$task.Categories = $tsk.Category

$task.DueDate = $tsk.Dt

$task.ReminderTime = $tsk.Tm

$task.save()

}#end foreach

$outlook = $null

--------------------------------------------------------
The script seems to work fine so long as the category already exists in Outlook ( I didn't test to see if it works if the category does not exist).
Comments and suggestions are welcome....

Thanks

KarlMitschkeUser is Offline
Basic Member
Basic Member
Posts:161

--
27 Nov 2007 11:21 PM  
It works fine, and creates the category, BUT you need to either have Outlook wrappers or use the constants as follows:

$olTaskItem = 3
$olFolderTasks = 13

(From Lee Holmes blog) http://www.leeholmes.com/blog/GettingThingsDoneOutlookTaskAutomationWithPowerShell.aspx
KarlMitschkeUser is Offline
Basic Member
Basic Member
Posts:161

--
28 Nov 2007 03:54 PM  

While I'm at it, you should make it more "powershell like" ;)

I don't like tasks, I like calendar items, and I'm in meetings at 8:30, so I want to be able to do something like:

set-learning -time 13:30 -duration 30 -type calendar -reminder 3 -private true -display free

This would make it a calendar item, with a 3 minute reminder, at 1:30 PM, lasting 1/2 hour, show it as FREE time, and set it as a private item.

Or, since I'm an Exchange guy, let me choose which cmdlets to use like:

set-learning -subset exchange

Or something like that.

However, for what you wanted to do, it works great!

Karl

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer