Created
August 13, 2016 21:46
-
-
Save MSAdministrator/558e1d07c5136db0317f0d92ad95763c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this is the actual call, but for this scripts focus it should be commented out | |
#$CalEvents = Invoke-RestMethod -Uri "https://outlook.office365.com/api/v1.0/users/me/calendarview?startDateTime=$(Get-Date)&endDateTime=$((Get-Date).AddDays(7))&`$top=10" -Credential $cred | |
#You an grab this from here: https://gist.github.com/MSAdministrator/bb18fa1d764aaaa64368edcdb36af35c | |
$CalEvents = Import-CliXML 'C:\users\$($env:username)\Desktop\CalEventsObject.xml' | |
$i = $(Get-Date) | |
foreach ($item in $CalEvents) | |
{ | |
$DayTime = @() | |
$date = "{0:MMMM, d}" -f [datetime]$item.start | |
for ($i = $i; $i -lt $i.AddDays(7); $i.AddDays(1)) | |
{ | |
if ($date -like $i.ToString("MMMM, d")) | |
{ | |
for ($b = 8; $b -le 17; $b++) | |
{ | |
$StartDayTime = @() | |
if ([datetime]$item.Start -match "$($b):00") | |
{ | |
$StartDayTime = "$($b):00 to $($b + 1):00 - Busy" #"{0:H:mm}" -f [datetime]$item.End) - Busy" | |
} | |
else | |
{ | |
$StartDayTime = "$($b):00 to $($B + 1):00 - Free" | |
} | |
$DayTime += $StartDayTime | |
$StartDayTime = @() | |
#write-host "Start Time: $StartDayTime" | |
} | |
} | |
} | |
$DayTime | sort -Descending -Unique | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment