Skip to content

Instantly share code, notes, and snippets.

@jasonjoh
jasonjoh / workaround.cs
Created April 20, 2020 15:40
How to update mailbox settings with .NET Graph SDK
var userId = "some-id";
var mailboxSettings = new MailboxSettings
{
AutomaticRepliesSetting = new AutomaticRepliesSetting
{
Status = AutomaticRepliesStatus.AlwaysEnabled,
InternalReplyMessage = "Hi",
ExternalReplyMessage = "Bye"
}
@jasonjoh
jasonjoh / GetSigningKeys.cs
Created November 10, 2017 19:59
GetSigningKeys
private List<SecurityKey> GetSigningKeys()
{
// TODO: Implement a cache of signing keys with the auth metadata URL
// as an index
// When requests come in to validate a token, check if you already have cached signing keys
// for that URL
// Load tokens
var webClient = new WebClient();
var authMetaData = JsonConvert.DeserializeObject<ExchangeAuthMetadata>(webClient.DownloadString(AppContext.MetadataUrl));
@jasonjoh
jasonjoh / sendactionablemessage.py
Last active October 17, 2023 12:45
A sample Python script that sends an actionable message via the Office 365 SMTP server.
#! /usr/local/bin/python
"""Sends an actionable message to yourself
Usage: 'sendactionablemessage.py -u <username> -p <password>'
"""
import sys
import getopt
from smtplib import SMTP as SMTP
from email.mime.text import MIMEText
@jasonjoh
jasonjoh / test.md
Last active June 8, 2023 10:03
Hello World Markdown

Hello World

This is content converted from Markdown!

Here's a JSON sample:

{
  "foo": "bar"
}
@jasonjoh
jasonjoh / test.html
Last active November 11, 2016 17:27
Hello World Html
<html>
<head>
<style>
h1 {
font-family: Calibri;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
@jasonjoh
jasonjoh / example.cs
Created February 12, 2016 21:00
BuildingRequest event handler for OutlookServicesClient to insert user's email address into the Users segment
// When using the v2 or beta endpoints of the Outlook API, the OutlookServicesClient class sends PATCH requests
// to a URL that contains the user's unique identifier in <guid>@<guid> format. This fails when authenticating
// with an app-only token.
// To work around this, you can implement an event handler for the BuildingRequest event on the client's .Context
// property, and replace the old user spec with the user's email.
// Sample function that calls an update on an event
public async Task<ActionResult> UpdateEvent(AppState passedAppState)
{