-
Notifications
You must be signed in to change notification settings - Fork 100
/
fbBoardGraph.ps1
78 lines (66 loc) · 2.85 KB
/
fbBoardGraph.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$mbHash = @{ }
$mbHash.Add("gscales@datarumble.com", "Glen Scales")
$mbHash.Add("jcool@datarumble.com", "Jcool")
$mbHash.Add("mec@datarumble.com", "mec")
$tmValHash = @{ }
$tidx = 0
for ($vsStartTime = [DateTime]::Parse([DateTime]::Now.ToString("yyyy-MM-dd 0:00")); $vsStartTime -lt [DateTime]::Parse([DateTime]::Now.ToString("yyyy-MM-dd 0:00")).AddDays(1); $vsStartTime = $vsStartTime.AddMinutes(30)) {
$tmValHash.add($vsStartTime.ToString("HH:mm"), $tidx)
$tidx++
}
$usrIdx = 0
$frow = $true
$displayStartTime = [DateTime]::Parse([DateTime]::Now.ToString("yyyy-MM-dd 08:30"))
$displayEndTime = [DateTime]::Parse([DateTime]::Now.ToString("yyyy-MM-dd 17:30"))
$avResults = Get-EXRSchedule -Mailboxes $mbHash.Keys -Start $displayStartTime -EndTime $displayEndTime -availabilityViewInterval 30
foreach ($fbResult in $avResults) {
if ($frow -eq $true) {
$fbBoard = $fbBoard + "<table><tr bgcolor=`"#95aedc`">" + "`r`n"
$fbBoard = $fbBoard + "<td align=`"center`" style=`"width=200;`" ><b>User</b></td>" + "`r`n"
for ($stime = $displayStartTime; $stime -lt $displayEndTime; $stime = $stime.AddMinutes(30)) {
$fbBoard = $fbBoard + "<td align=`"center`" style=`"width=50;`" ><b>" + $stime.ToString("HH:mm") + "</b></td>" + "`r`n"
}
$fbBoard = $fbBoard + "</tr>" + "`r`n"
$frow = $false
}
$aphash = @{}
foreach($item in $fbResult.scheduleItems){
$key = ([DateTime]::Parse($item.start.dateTime).ToString("HH:mm"))
if(!$aphash.ContainsKey($key)){
$aphash.Add($key,$item.Subject)
}
}
$aphash
Write-Host ""
if($mbHash.ContainsKey($fbResult.scheduleId)){
$fbBoard = $fbBoard + "<td bgcolor=`"#CFECEC`"><b>" + $mbHash[$fbResult.scheduleId] + "</b></td>" + "`r`n"
}else{
$fbBoard = $fbBoard + "<td bgcolor=`"#CFECEC`"><b>" + $fbResult.scheduleId + "</b></td>" + "`r`n"
}
$CurrentTime = $displayStartTime
$fbResult.availabilityView.ToCharArray() | ForEach-Object {
$title = "title="
switch ($_) {
0 {$bgColour = "bgcolor=`"#41A317`""}
1 {$bgColour = "bgcolor=`"#52F3FF`""}
2 {$bgColour = "bgcolor=`"#153E7E`""}
3 {$bgColour = "bgcolor=`"#4E387E`""}
4 {$bgColour = "bgcolor=`"#98AFC7`""}
}
$key = $CurrentTime.ToString("HH:mm");
if($aphash.ContainsKey($key)){
$title = "title=" + $aphash[$key]
}
if ($title -ne "title=") {
$fbBoard = $fbBoard + "<td " + $bgColour + " " + $title + "></td>" + "`r`n"
}
else {
$fbBoard = $fbBoard + "<td " + $bgColour + "></td>" + "`r`n"
}
$CurrentTime = $CurrentTime.AddMinutes(30)
}
$fbBoard = $fbBoard + "</tr>" + "`r`n"
$usrIdx++
}
$fbBoard = $fbBoard + "</table>" + " "
$fbBoard | out-file "c:\temp\fbboard.htm"