KB0035 - How to add the Calendar and other components

KB0035 - How to add the Calendar and other components

Purpose

The purpose of this article is to demonstrate how to install and use the Calendar component (module)

Background

There is a growing list of add-on components (modules) for PowerShell Universal at https://github.com/ironmansoftware/universal-modules.

Installation Procedure

1. In PSU, select Platform, Modules.
2. Select PSGallery as the package source from the drop-down menu.
3. Search for Universal.Components.Calendar.


4. Assuming there are results (as shown in the above animated gif), click 'Install' on the result to install the module.
5. Confirm that the module installed by checking selecting Platform, Modules again and then checking inside of the Univeral Modules folder (as shown in the above animated gif).

You now have the Calendar component installed to the Integrated environment which provides New-UDCalendar and New-UDCalendarEvent. Note that you must have this module installed in any  PowerShell environment that you plan to build dashboards with that use the Calendar component.

Usage Example

[array]$calendar_events = 1..((Get-Date -Date ([string]((Get-Date).Year+1) + "-01-01"))-(Get-Date '00:00')).Days | `
ForEach-Object {(Get-Date '00:00').AddDays($_)} | Where-Object {$_.DayOfWeek -eq 'Monday'} | `
ForEach-Object { New-UDCalendarEvent -Title 'Happy Monday!' -Start $_ -BackgroundColor 'Green' -BorderColor 'Red' -AllDay }

New-UDDashboard -Title 'PSU Calendar Demo' -Pages @(
    New-UDPage -Name 'PSU Calendar Demo' -Content {
        New-UDCalendar -Id 'calendar_01' -Events $calendar_events -InitialDate (Get-Date).AddMonths(1) -DateClicked {
            $EventData_string = $EventData | ConvertTo-Json -Compress
            Show-UDToast -Message $EventData_string -Duration 5000
        }
    }
)
The above dashboard will render a calendar with each remaining Monday of the year marked with an event.



The above screenshot shows the example code rendered

Notes

1. Be sure to see all of the add-on modules (components) available for PowerShell Universal at https://github.com/ironmansoftware/universal-modules
2. For the complete documentation around the components (modules) available for PowerShell Universal, please see https://docs.powershelluniversal.com/platform/modules

    • Related Articles

    • PowerShell Universal Service crashes on startup after an upgrade to 1.4.6

      Version: PowerShell Universal 1.4.6 Issue The PowerShell Universal service will crash with the following error in Event Viewer.  Application: Universal.Server.exe CoreCLR Version: 4.700.19.56402 .NET Core Version: 3.1.0 Description: The process was ...
    • KB0074 - Connecting to PSU API w/Windows Auth

      Scope This article applies only to PSU environments where Windows Authentication[1] is enabled and known to be working[2]. Problem You are not able to interact with the PSU instance using the Invoke-WebRequest PowerShell cmdlet even though logging in ...
    • KB0020 - Firewall Configuration for PowerShell Universal

      Purpose The purpose of this document is to provide information about the necessary filewall settings required by PowerShell Universal. Overview PowerShell Universal does not offer a built in firewall. We recommend using standard firewalls available ...
    • KB0011 - Are licenses different between Production, QA and Test/Development servers?

      Update January 24th, 2023 Adam recently summarized the Developer's license per below: The only real limitation on the developer license is that it cannot be accessed remotely. The server is only available on loopback when using the dev license. If ...
    • KB0066 - Get-WMIObject cmdlet not working

      Scope This article applies to any scenario where the Get-WMIObject cmdlet is expected to be available and functioning within a PowerShell Universal instance. Effectively, this article will only apply to instances that run under the Windows operating ...