Skip to content

Instantly share code, notes, and snippets.

View phillipharding's full-sized avatar

Phil Harding phillipharding

View GitHub Profile
@phillipharding
phillipharding / body.json
Created October 17, 2020 15:38 — forked from garrytrinder/m365-identity.sh
Create custom Azure AD identity for use with CLI for Microsoft 365 using Azure CLI
{
"isFallbackPublicClient": true,
"publicClient": {
"redirectUris": [
"https://login.microsoftonline.com/common/oauth2/nativeclient"
]
},
"web": {
"implicitGrantSettings": {
"enableIdTokenIssuance": false
@phillipharding
phillipharding / implicitflow_usage.js
Created June 20, 2017 13:12 — forked from paulryan/implicitflow_usage.js
Usage of OAuth implict flow lib
var aadAppClientId = "8BE5AA0E-F900-4BDF-A7CF-71B3CC53B78E";
var resource = "https://graph.microsoft.com"
var query = "/v1.0/me/events";
var tokenFactory = new CC.CORE.Adal.AppTokenFactory(aadAppClientId, resource);
tokenFactory.ExecuteQuery(query)
.done(function (response) {
// Success!
})
.fail(function (response) {
// NOTE: Provide a link to renew an expired or yet to be approved session:
@phillipharding
phillipharding / adal_lib.js
Created June 20, 2017 13:11 — forked from paulryan/adal_lib.js
Custom "adal" implementation for OAuth implict flow
var CC = CC || {};
CC.CORE = CC.CORE || {};
CC.CORE.Log = function (errMsg) {
// console.log is undefined in IE10 and earlier unless in debug mode, so must check for it
if (typeof window.console === "object" && typeof console.log === "function") {
console.log(errMsg);
}
};
@phillipharding
phillipharding / cache_lib.js
Created June 20, 2017 13:09 — forked from paulryan/cache_lib.js
SessionStorage cache library
var CC = CC || {};
CC.CORE = CC.CORE || {};
CC.CORE.Cache = (function () {
var defaultCacheExpiry = 15 * 60 * 1000; // default is 15 minutes
var aMinuteInMs = (1000 * 60);
var anHourInMs = aMinuteInMs * 60;
var getCacheObject = function () {
// Using session storage rather than local storage as caching benefit
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="ListName" type="string">{$ListId:Documents;}</property>
<property name="ListId" type="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">$ListId:Documents;</property>
<View WebPartZoneID="wpzHeader" WebPartOrder="0" List="Lists/PromotedLinks" DefaultView="FALSE" BaseViewID="1" Hidden="TRUE">
<![CDATA[
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>