Artur Carvalho
Artur Carvalho

Reputation: 7167

Get latest appointments from outlook with powershell

I want to get the appointments for today and tomorrow of 3 different persons that are on my address book. These persons have the calendar shared on outlook.

How can I get this info with powershell? I don't mind getting the data from a local outlook instance but would prefer something connected directly to the server.

Upvotes: 3

Views: 8371

Answers (3)

DeDenker
DeDenker

Reputation: 404

Looking at whole function/script from Scripting Guy, this seems a useful. Here an example output:

Subject  Start                                   Duration Location
-------   -----                                  -------- --------
Emea IT support team x64 b... 16-9-2016 14:30:00 - 30 -
Citrix receiver in the NL ... 13-9-2016 12:30:00 - 30 - Webex
Workstations OS Patching  ... 12-9-2016 12:30:00 - 30 - INPNQ-Conference Room
Remedy Demo & Training Ses... 13-9-2016 09:30:00 - 120 - webex

It does require to have Outlook running.

Upvotes: -2

Shay Levy
Shay Levy

Reputation: 126902

You can start with this (local outlook instance), you may need to further filter the result based on some properties to find your friends information:

$olFolderCalendar = 9
$ol = New-Object -ComObject Outlook.Application
$ns = $ol.GetNamespace('MAPI')
$Start = (Get-Date).AddDays(-1).ToShortDateString()
$End = (Get-Date).ToShortDateString()

$Filter = "[MessageClass]='IPM.Appointment' AND [Start] > '$Start' AND [End] < '$End'"
$ns.GetDefaultFolder($olFolderCalendar).Items.Restrict($Filter) 

Upvotes: 6

mjolinor
mjolinor

Reputation: 68341

If it's Exchange 2007 or better you have to option of using the Exchange Web Services Managed API with Powershell. The API is here:

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13480

Glen Scales has some excellent examples of using it with Powershell on his blog:

http://gsexdev.blogspot.com/2009/11/basic-powershell-script-to-show.html

Upvotes: 0

Related Questions