Stephan van Rooij

Software architect with a passion for home automation.

Create Outlook category for everyone


Did you know you can categorize items in your Outlook calendar to give them a different color (in most official Outlook clients)? You can help your users by pre-configuring some default categories. You can also create categories for your users if you have some automation to create items in their calendar by some automated way.

Using Graph PowerShell

These scripts use the new Graph PowerShell Modules, if you don’t have them already, be sure to install them prior to using any of these scripts.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 
Install-Module Microsoft.Graph.Users -Scope CurrentUser
Install-Module Microsoft.Graph.Groups -Scope CurrentUser

Create category for single user

Use this script to create some category for a single user. We will use this to test it out, and build from there.

The color is set with a preset between 1 and 20 (I believe), and I cannot find the list at the moment.

# Change accordingly
$tenantId = "21009bcd-06df-4cdf-b114-e6a326ef3368";
# you can use either the user ID or the UPN.
$userId = "613f5b2e-4360-4665-956b-ffeaa0f3014b";

# Connect to Graph with correct scopes
Connect-MgGraph -TenantId $tenantId -Scopes "MailboxSettings.ReadWrite"

$category = @{
	DisplayName = "Schedule"
	Color = "preset9"

New-MgUserOutlookMasterCategory -UserId $userId -BodyParameter $category;

Create category for all users in a group

This script will create this new category for all users in a certain group, but that might result in duplicates. Use careful.

# Change accordingly
$tenantId = "21009bcd-06df-4cdf-b114-e6a326ef3368";
$groupId = "613f5b2e-4360-4665-956b-ffeaa0f3014b";

# Connect to Graph with correct scopes
Connect-MgGraph -TenantId $tenantId -Scopes "MailboxSettings.ReadWrite","GroupMember.Read.All"

$category = @{
	DisplayName = "Schedule"
	Color = "preset9"

$members = Get-MgGroupMember -GroupId $groupId;

foreach ($member in $members) {
  New-MgUserOutlookMasterCategory -UserId $member.Id -BodyParameter $category -ErrorAction SilentlyContinue;

Protect against SSO for Graph PowerShell


Why would you want to disable SSO for some cloud app, we love SSO, it makes our life easier? I agree, single-sign-on is great, until it is used without the knowledge of a user that logged-in with his admin account (don’t do that!).

Replace an owner in all their Teams


Microsoft Teams without an owner are no longer manageable, so what happens if some user leaves the company and he/she was an owner in several Teams?

Github Actions: Use secret file


Github Actions are great for automating tests and builds, among other things. If you need a secret (key/token/password), you can add those in the configuration and use them in your workflow.

Sometimes you need a file that is meant to be secret inside your workflow. This post shows you how to securely save this file as a secret and recreate the file during build. We use base64 encoding for a way to convert any file to a string that can be saved in the secrets.

This is all done in powershell core, which is available in all (Windows/Mac/Linux) runners on Github. The code below should work on any platform, but is only tested on a windows-latest runner.

Like what you're seeing? Consider Sharing on Twitter or Sponsoring me