One-Liner to List Calendar Appointments with a Simple Filter

So this post is born out of my playing with writing a script to help me be a better PFE.  I need to automatically create calendar appoints to remind me to get all my PFE “paperwork” in on time.  my colleagues will know what I am talking about when I say my TRs.  My thought was to simply use the Outlook.Application Com object to search for certain calendar appointments whose subject begins with a certain word.  I have just started playing with the code for what will later become the large script, but its funny…I have forgotten just how easily you can work with your Outlook data.

Take this one-liner, yes you believe this can be done in one line…wow:

(new-object -comobject outlook.application).GetNamespace("MAPI").GetDefaultFolder(9).items | where-object {$_.end -gt (get-date) -and $_.subject -like "AXIS*"} | format-table subject,end

This creates a simple table listing all calendar appoints in my main default calendar that end later than right now and that have a subject that starts with a word, in this case “Axis”.  It is just so simple.

One of these days I will take the time to actually write the script I am thinking of where it starts with this list and then creates complementary appointments for these.  I will share that when I write it, I just felt like I wanted to share just how simple it can be to work with Outlook data.

 

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm.