Skip to content

Instantly share code, notes, and snippets.

View waldekmastykarz's full-sized avatar
🥑
Microsoft 365

Waldek Mastykarz waldekmastykarz

🥑
Microsoft 365
View GitHub Profile
@waldekmastykarz
waldekmastykarz / list-view.json
Created January 30, 2024 11:53
List board view with colored cards following the card status
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/board-formatting.schema.json",
"hideSelection": false,
"formatter": {
"elmType": "div",
"attributes": {
"class": "sp-card-container sp-card-container-noPadding"
},
"children": [
{
@waldekmastykarz
waldekmastykarz / customers-api.json
Last active December 20, 2023 15:38
Dev Proxy CRUD API
{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v1.0/crudapi.schema.json",
"baseUrl": "https://api.contoso.com/v1/customers",
"dataFile": "customers-data.json",
"actions": [
{
"action": "getAll"
},
{
"action": "getOne",
@waldekmastykarz
waldekmastykarz / c#-lambda-queries.json
Last active December 20, 2023 07:02
Customers API definition
{
"baseUrl": "https://api.contoso.com/v1/customers",
"dataFile": "customers-data.json",
"actions": [
{
"action": "getAll"
},
{
"action": "getOne",
"url": "/{customer-id}",
@waldekmastykarz
waldekmastykarz / trust-cert.sh
Created December 16, 2023 14:35
Trust a certificate on macOS
# export cert from keychain to PEM
security find-certificate -c "Titanium Root Certificate Authority" -a -p > proxy-cert.pem
# add trusted cert to keychain
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db proxy-cert.pem
@waldekmastykarz
waldekmastykarz / setup.ps1
Created December 15, 2023 15:47
Proxy setup
New-Item -ItemType Directory -Force -Path .\devproxy -ErrorAction Stop | Out-Null
Set-Location .\devproxy | Out-Null
# Get the full path of the current directory
$full_path = Resolve-Path .
# Get the latest Dev Proxy version
Write-Host "Getting latest Dev Proxy version..."
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/dev-proxy/releases/latest" -ErrorAction Stop
$version = $response.tag_name
@waldekmastykarz
waldekmastykarz / toggle-proxy.sh
Created December 11, 2023 19:00
Toggle macOS proxy settings
#!/bin/bash
arg1=$1
# Get the list of network services
network_services=$(networksetup -listallnetworkservices | tail -n +2)
if [[ "$arg1" == "on" ]]; then
while IFS= read -r service; do
networksetup -setwebproxy "$service" 127.0.0.1 8000
@waldekmastykarz
waldekmastykarz / build.sh
Created October 31, 2023 08:27
Build m365proxy locally
# stop on the first error
set -e
architecture="osx-x64"
release="m365-developer-proxy-$architecture-local"
# Clean
rm -rf ./$release
# Publish
@waldekmastykarz
waldekmastykarz / ContentService.cs
Created October 12, 2023 09:07
Build Microsoft Graph connector article - ContentService.cs
using Markdig;
using Microsoft.Graph.Models.ExternalConnectors;
using YamlDotNet.Serialization;
// [...] trimmed for brevity
static class ContentService
{
static IEnumerable<BlogPost> Extract()
{
@waldekmastykarz
waldekmastykarz / ConnectionService.cs
Created October 12, 2023 09:00
Build Microsoft Graph connector article - ConnectionService.cs
static class ConnectionService
{
async static Task CreateConnection()
{
await GraphService.Client.External.Connections
.PostAsync(ConnectionConfiguration.ExternalConnection);
}
async static Task CreateSchema()
{
@waldekmastykarz
waldekmastykarz / ConnectionConfiguration.cs
Last active October 12, 2023 09:01
Build Microsoft Graph connector article - ConnectionConfiguration.cs
using System.Text.Json;
using Microsoft.Graph.Models;
using Microsoft.Graph.Models.ExternalConnectors;
static class ConnectionConfiguration
{
public static ExternalConnection ExternalConnection
{
get
{