Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Vincent Biret baywet

🏠
Working from home
View GitHub Profile
@baywet
baywet / app.go
Last active Nov 23, 2021
msgraph go sdk fluent api demo
View app.go
// indexes into the users and message folders collections using the fluent style API to list out messages
client.UserById("jane@contoso.com").MessageFoldersById(“Inbox”).Messages().Get(nil)
// sends a message using the models and the fluent style API POST method
requestBody := msgraphsdk.NewSendMailRequestBody()
message := msgraphsdk.NewMessage()
requestBody.SetMessage(message)
subject := "Meet for lunch?"
message.SetSubject(&subject)
body := msgraphsdk.NewItemBody()
@baywet
baywet / app.go
Created Nov 18, 2021
ms graph go beta sdk
View app.go
import (
azidentity "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
a "github.com/microsoft/kiota/authentication/go/azure"
"context"
// this line imports the v1.0 SDK
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
// this line imports the beta SDK
msgraphbetasdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
)
@baywet
baywet / app.go
Last active Nov 23, 2021
Sample for the go sdk preview announcement
View app.go
import (
azidentity "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
a "github.com/microsoft/kiota/authentication/go/azure"
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
)
// the following block creates a new device code credential using the Azure Identity library which will be used by the authentication provider to obtain an access token for requests
cred, err := azidentity.NewDeviceCodeCredential(&azidentity.DeviceCodeCredentialOptions{
@baywet
baywet / testScript.ps1
Created Sep 8, 2021
AGS request payload compression test
View testScript.ps1
$accessToken = "<AccessTokenWithMailSendPermission>"
$srcFileName = "PathToRequestPayloadUncompress-SeeOtherFile"
$destFileName = "APath"
$srcFileStream = New-Object System.IO.FileStream($srcFileName,([IO.FileMode]::Open),([IO.FileAccess]::Read),([IO.FileShare]::Read))
$destFileStream = New-Object System.IO.FileStream($destFileName,([IO.FileMode]::Create),([IO.FileAccess]::Write),([IO.FileShare]::None))
$gzip = New-Object System.IO.Compression.GZipStream($destFileStream,[System.IO.Compression.CompressionMode]::Compress)
$gzip.CopyTo($srcFileStream)
$gzip.Flush()
$destFileStream.Dispose()
Invoke-WebRequest -UseBasicParsing -Uri "https://graph.microsoft.com/v1.0/me/sendMail" `
@baywet
baywet / MS Graph Change Notifications useful links.txt
Created Oct 1, 2020
Microsoft Graph Change Notifications useful links
View MS Graph Change Notifications useful links.txt
View Northappemailmodel.js
import { ACTIVITY_TYPE_DIGITAL, DIGITAL_CATEGORY_EMAIL } from '../../definitions';
export const modelName = 'email';
export const modelVersion = '1';
export const explanation = {
text:
'Calculations take into account the direct emissions associated with the email infrastructure worldwide.',
links: [
{
label: 'Phys.org (2015)',
View Install-PnPPowershell.ps1
param([String]$version)
Install-PackageProvider -Name NuGet -Force -Scope "CurrentUser"
if($version -ne "") {
Install-Module SharePointPnPPowerShellOnline -Scope "CurrentUser" -RequiredVersion $version -Verbose -AllowClobber -Force
} else {
Install-Module SharePointPnPPowerShellOnline -Scope "CurrentUser" -Verbose -AllowClobber -Force
}
View pnpmdebugnodesass.log
This file has been truncated, but you can view the full file.
---
0 warn pnpm:
message: "using --force I sure hope you know what you are doing"
prefix: "C:\\sources\\gitttl\\SiteCreation\\SiteCreationForm"
1 info pnpm:
message: "Installing a flat node_modules. Use flat node_modules only if you rely on buggy dependencies that you cannot fix."
prefix: "C:\\sources\\gitttl\\SiteCreation\\SiteCreationForm"
2 debug pnpm:package-json:
initial:
View office365clirefactor.ts
private mapNpmCommand(command: string, packagesDevExact: string[],
packagesDevInexact: string[], packagesDepExact: string[], packagesDepInexact: string[],
packagesDepUn: string[], packagesDevUn: string[]): void {
const npmReduceRegex: RegExp = /npm\s+(i|un)\s+([\w\d\@\/\.-]+)\s+(-D|-S)?\s?(-E)?/gm;
const npmReduceMatch: RegExpExecArray | null = npmReduceRegex.exec(command);
const packageNameGroupId: number = 2;
const installCommandGroupId: number = 1;
const dependencyCategoryGroupId: number = 3;
const exactGroupId: number = 4;
if (npmReduceMatch) {
@baywet
baywet / bringImportedRepoBranchesBackToForked.sh
Created Mar 20, 2018
two samples to solve situations where repositories have been imported instead of forked
View bringImportedRepoBranchesBackToForked.sh
git remote add downstream UrlOfImportedRepo
#foreach branch you want to bring back
git fetch downstream/branchname
git checkout branchname
git merge downstream/branchname #hopefully your history is not a mess and you don’t have conflicts to handle
git push origin
#end of foreach
git remote remove downstream